@carbon/ibm-products 2.33.0 → 2.35.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +31990 -32061
- 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 +38 -17
- 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 +636 -24096
- 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 +2342 -17830
- 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/ActionSet/ActionSet.d.ts +38 -2
- package/es/components/ActionSet/ActionSet.js +3 -5
- package/es/components/CoachmarkFixed/CoachmarkFixed.js +1 -1
- package/es/components/ConditionBuilder/ConditionBuilder.d.ts +5 -0
- package/es/components/ConditionBuilder/ConditionBuilder.js +125 -0
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +10 -0
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +92 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataTreeContext.d.ts +38 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataTreeContext.js +88 -0
- package/es/components/ConditionBuilder/assets/sampleInput.d.ts +58 -0
- package/es/components/ConditionBuilder/index.d.ts +1 -0
- package/es/components/CreateFullPage/CreateFullPage.js +3 -19
- package/es/components/CreateFullPage/CreateFullPageStep.js +22 -7
- package/es/components/CreateSidePanel/CreateSidePanel.d.ts +81 -2
- package/es/components/CreateSidePanel/CreateSidePanel.js +5 -2
- package/es/components/CreateTearsheetNarrow/CreateTearsheetNarrow.d.ts +82 -2
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +5 -117
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +12 -111
- package/es/components/DataSpreadsheet/utils/commonEventHandlers.d.ts +4 -0
- package/es/components/DataSpreadsheet/utils/commonEventHandlers.js +304 -0
- package/es/components/Datagrid/Datagrid/DatagridContent.js +2 -1
- package/es/components/Datagrid/Datagrid/DatagridEmptyBody.js +4 -1
- package/es/components/Datagrid/Datagrid/DatagridRefBody.js +3 -1
- package/es/components/Datagrid/Datagrid/DatagridSimpleBody.js +4 -1
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +6 -2
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.d.ts +1 -1
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +4 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.d.ts +2 -1
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +4 -3
- package/es/components/Datagrid/Datagrid/addons/stateReducer.js +2 -1
- package/es/components/Datagrid/useEditableCell.js +15 -0
- package/es/components/DelimitedList/DelimitedList.d.ts +27 -2
- package/es/components/DelimitedList/DelimitedList.js +0 -1
- package/es/components/EditInPlace/EditInPlace.d.ts +97 -5
- package/es/components/EditInPlace/EditInPlace.js +10 -6
- package/es/components/EditSidePanel/EditSidePanel.d.ts +92 -2
- package/es/components/EditSidePanel/EditSidePanel.js +8 -10
- package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.d.ts +61 -2
- package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -3
- package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.d.ts +61 -2
- package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +1 -2
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.d.ts +61 -2
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -3
- package/es/components/ExportModal/ExportModal.d.ts +110 -2
- package/es/components/ExportModal/ExportModal.js +10 -4
- package/es/components/FilterPanel/FilterPanelAccordion/FilterPanelAccordion.d.ts +5 -0
- package/es/components/FilterPanel/FilterPanelAccordion/FilterPanelAccordion.js +83 -0
- package/es/components/FilterPanel/FilterPanelAccordionItem/FilterPanelAccordionItem.d.ts +5 -0
- package/es/components/FilterPanel/FilterPanelAccordionItem/FilterPanelAccordionItem.js +94 -0
- package/es/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.d.ts +5 -0
- package/es/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.js +8 -10
- package/es/components/FilterPanel/FilterPanelCheckbox/index.d.ts +1 -0
- package/es/components/FilterPanel/FilterPanelCheckboxWithOverflow/FilterPanelCheckboxWithOverflow.d.ts +10 -0
- package/es/components/FilterPanel/FilterPanelCheckboxWithOverflow/FilterPanelCheckboxWithOverflow.js +157 -0
- package/es/components/FilterPanel/FilterPanelGroup/FilterPanelGroup.d.ts +5 -0
- package/es/components/FilterPanel/FilterPanelGroup/FilterPanelGroup.js +72 -0
- package/es/components/FilterPanel/FilterPanelLabel/FilterPanelLabel.js +2 -2
- package/es/components/FilterPanel/FilterPanelSearch/FilterPanelSearch.d.ts +5 -0
- package/es/components/FilterPanel/FilterPanelSearch/FilterPanelSearch.js +92 -0
- package/es/components/FilterPanel/index.d.ts +5 -0
- package/es/components/HTTPErrors/HTTPError403/HTTPError403.d.ts +40 -2
- package/es/components/HTTPErrors/HTTPError403/HTTPError403.js +1 -1
- package/es/components/HTTPErrors/HTTPError404/HTTPError404.d.ts +40 -2
- package/es/components/HTTPErrors/HTTPError404/HTTPError404.js +1 -1
- package/es/components/ImportModal/ImportModal.d.ts +136 -2
- package/es/components/ImportModal/ImportModal.js +3 -2
- package/es/components/InlineTip/InlineTip.d.ts +90 -2
- package/es/components/InlineTip/InlineTip.js +3 -2
- package/es/components/Nav/Nav.js +1 -1
- package/es/components/Nav/NavList.js +7 -7
- package/es/components/NotificationsPanel/NotificationsPanel.js +1 -1
- package/es/components/OptionsTile/OptionsTile.d.ts +77 -3
- package/es/components/OptionsTile/OptionsTile.js +9 -20
- package/es/components/PageHeader/PageHeader.js +3 -3
- package/es/components/PageHeader/PageHeaderUtils.d.ts +1 -1
- package/es/components/PageHeader/PageHeaderUtils.js +4 -3
- package/es/components/RemoveModal/RemoveModal.d.ts +81 -7
- package/es/components/RemoveModal/RemoveModal.js +1 -0
- package/es/components/ScrollGradient/ScrollGradient.d.ts +5 -0
- package/es/components/ScrollGradient/ScrollGradient.js +156 -0
- package/es/components/ScrollGradient/constants.d.ts +15 -0
- package/es/components/ScrollGradient/constants.js +121 -0
- package/es/components/ScrollGradient/index.d.ts +1 -0
- package/es/components/SidePanel/SidePanel.d.ts +144 -2
- package/es/components/SidePanel/SidePanel.js +100 -75
- package/es/components/StatusIcon/StatusIcon.d.ts +34 -2
- package/es/components/StatusIcon/StatusIcon.js +97 -95
- package/es/components/SteppedAnimatedMedia/SteppedAnimatedMedia.d.ts +23 -2
- package/es/components/SteppedAnimatedMedia/SteppedAnimatedMedia.js +6 -5
- package/es/components/TagOverflow/TagOverflow.d.ts +5 -0
- package/es/components/TagOverflow/TagOverflow.js +209 -0
- package/es/components/TagOverflow/constants.d.ts +14 -0
- package/es/components/TagOverflow/constants.js +30 -0
- package/es/components/TagOverflow/index.d.ts +1 -0
- package/es/components/Tearsheet/TearsheetNarrow.d.ts +105 -6
- package/es/components/Tearsheet/TearsheetNarrow.js +6 -1
- package/es/components/Toolbar/Toolbar.d.ts +23 -5
- package/es/components/Toolbar/Toolbar.js +30 -26
- package/es/components/TruncatedList/TruncatedList.js +5 -3
- package/es/components/UserAvatar/UserAvatar.js +7 -4
- package/es/components/index.d.ts +5 -2
- package/es/global/js/package-settings.d.ts +8 -0
- package/es/global/js/package-settings.js +8 -0
- package/es/index.js +9 -0
- package/es/settings.d.ts +8 -0
- package/lib/components/ActionSet/ActionSet.d.ts +38 -2
- package/lib/components/ActionSet/ActionSet.js +3 -5
- package/lib/components/CoachmarkFixed/CoachmarkFixed.js +1 -1
- package/lib/components/ConditionBuilder/ConditionBuilder.d.ts +5 -0
- package/lib/components/ConditionBuilder/ConditionBuilder.js +132 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +10 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +100 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataTreeContext.d.ts +38 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataTreeContext.js +98 -0
- package/lib/components/ConditionBuilder/assets/sampleInput.d.ts +58 -0
- package/lib/components/ConditionBuilder/index.d.ts +1 -0
- package/lib/components/CreateFullPage/CreateFullPage.js +2 -18
- package/lib/components/CreateFullPage/CreateFullPageStep.js +20 -5
- package/lib/components/CreateSidePanel/CreateSidePanel.d.ts +81 -2
- package/lib/components/CreateSidePanel/CreateSidePanel.js +5 -2
- package/lib/components/CreateTearsheetNarrow/CreateTearsheetNarrow.d.ts +82 -2
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +5 -117
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +12 -111
- package/lib/components/DataSpreadsheet/utils/commonEventHandlers.d.ts +4 -0
- package/lib/components/DataSpreadsheet/utils/commonEventHandlers.js +311 -0
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +2 -1
- package/lib/components/Datagrid/Datagrid/DatagridEmptyBody.js +4 -1
- package/lib/components/Datagrid/Datagrid/DatagridRefBody.js +3 -1
- package/lib/components/Datagrid/Datagrid/DatagridSimpleBody.js +4 -1
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +5 -1
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.d.ts +1 -1
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +4 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.d.ts +2 -1
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +4 -3
- package/lib/components/Datagrid/Datagrid/addons/stateReducer.js +2 -1
- package/lib/components/Datagrid/useEditableCell.js +19 -0
- package/lib/components/DelimitedList/DelimitedList.d.ts +27 -2
- package/lib/components/DelimitedList/DelimitedList.js +0 -1
- package/lib/components/EditInPlace/EditInPlace.d.ts +97 -5
- package/lib/components/EditInPlace/EditInPlace.js +10 -6
- package/lib/components/EditSidePanel/EditSidePanel.d.ts +92 -2
- package/lib/components/EditSidePanel/EditSidePanel.js +8 -10
- package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.d.ts +61 -2
- package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -3
- package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.d.ts +61 -2
- package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +1 -2
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.d.ts +61 -2
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -3
- package/lib/components/ExportModal/ExportModal.d.ts +110 -2
- package/lib/components/ExportModal/ExportModal.js +10 -4
- package/lib/components/FilterPanel/FilterPanelAccordion/FilterPanelAccordion.d.ts +5 -0
- package/lib/components/FilterPanel/FilterPanelAccordion/FilterPanelAccordion.js +90 -0
- package/lib/components/FilterPanel/FilterPanelAccordionItem/FilterPanelAccordionItem.d.ts +5 -0
- package/lib/components/FilterPanel/FilterPanelAccordionItem/FilterPanelAccordionItem.js +101 -0
- package/lib/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.d.ts +5 -0
- package/lib/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.js +8 -10
- package/lib/components/FilterPanel/FilterPanelCheckbox/index.d.ts +1 -0
- package/lib/components/FilterPanel/FilterPanelCheckboxWithOverflow/FilterPanelCheckboxWithOverflow.d.ts +10 -0
- package/lib/components/FilterPanel/FilterPanelCheckboxWithOverflow/FilterPanelCheckboxWithOverflow.js +164 -0
- package/lib/components/FilterPanel/FilterPanelGroup/FilterPanelGroup.d.ts +5 -0
- package/lib/components/FilterPanel/FilterPanelGroup/FilterPanelGroup.js +79 -0
- package/lib/components/FilterPanel/FilterPanelLabel/FilterPanelLabel.js +2 -2
- package/lib/components/FilterPanel/FilterPanelSearch/FilterPanelSearch.d.ts +5 -0
- package/lib/components/FilterPanel/FilterPanelSearch/FilterPanelSearch.js +99 -0
- package/lib/components/FilterPanel/index.d.ts +5 -0
- package/lib/components/HTTPErrors/HTTPError403/HTTPError403.d.ts +40 -2
- package/lib/components/HTTPErrors/HTTPError403/HTTPError403.js +1 -1
- package/lib/components/HTTPErrors/HTTPError404/HTTPError404.d.ts +40 -2
- package/lib/components/HTTPErrors/HTTPError404/HTTPError404.js +1 -1
- package/lib/components/ImportModal/ImportModal.d.ts +136 -2
- package/lib/components/ImportModal/ImportModal.js +3 -2
- package/lib/components/InlineTip/InlineTip.d.ts +90 -2
- package/lib/components/InlineTip/InlineTip.js +3 -2
- package/lib/components/Nav/Nav.js +1 -1
- package/lib/components/Nav/NavList.js +7 -7
- package/lib/components/NotificationsPanel/NotificationsPanel.js +1 -1
- package/lib/components/OptionsTile/OptionsTile.d.ts +77 -3
- package/lib/components/OptionsTile/OptionsTile.js +9 -20
- package/lib/components/PageHeader/PageHeader.js +3 -3
- package/lib/components/PageHeader/PageHeaderUtils.d.ts +1 -1
- package/lib/components/PageHeader/PageHeaderUtils.js +4 -3
- package/lib/components/RemoveModal/RemoveModal.d.ts +81 -7
- package/lib/components/RemoveModal/RemoveModal.js +1 -0
- package/lib/components/ScrollGradient/ScrollGradient.d.ts +5 -0
- package/lib/components/ScrollGradient/ScrollGradient.js +163 -0
- package/lib/components/ScrollGradient/constants.d.ts +15 -0
- package/lib/components/ScrollGradient/constants.js +128 -0
- package/lib/components/ScrollGradient/index.d.ts +1 -0
- package/lib/components/SidePanel/SidePanel.d.ts +144 -2
- package/lib/components/SidePanel/SidePanel.js +100 -75
- package/lib/components/StatusIcon/StatusIcon.d.ts +34 -2
- package/lib/components/StatusIcon/StatusIcon.js +97 -95
- package/lib/components/SteppedAnimatedMedia/SteppedAnimatedMedia.d.ts +23 -2
- package/lib/components/SteppedAnimatedMedia/SteppedAnimatedMedia.js +6 -5
- package/lib/components/TagOverflow/TagOverflow.d.ts +5 -0
- package/lib/components/TagOverflow/TagOverflow.js +216 -0
- package/lib/components/TagOverflow/constants.d.ts +14 -0
- package/lib/components/TagOverflow/constants.js +34 -0
- package/lib/components/TagOverflow/index.d.ts +1 -0
- package/lib/components/Tearsheet/TearsheetNarrow.d.ts +105 -6
- package/lib/components/Tearsheet/TearsheetNarrow.js +6 -1
- package/lib/components/Toolbar/Toolbar.d.ts +23 -5
- package/lib/components/Toolbar/Toolbar.js +30 -26
- package/lib/components/TruncatedList/TruncatedList.js +5 -3
- package/lib/components/UserAvatar/UserAvatar.js +7 -4
- package/lib/components/index.d.ts +5 -2
- package/lib/global/js/package-settings.d.ts +8 -0
- package/lib/global/js/package-settings.js +8 -0
- package/lib/index.js +42 -0
- package/lib/settings.d.ts +8 -0
- package/package.json +3 -3
- package/scss/components/Coachmark/_coachmark-dragbar.scss +0 -1
- package/scss/components/Coachmark/_coachmark-tagline.scss +2 -2
- package/scss/components/ConditionBuilder/_carbon-imports.scss +9 -0
- package/scss/components/ConditionBuilder/_condition-builder.scss +25 -0
- package/scss/components/ConditionBuilder/_index-with-carbon.scss +9 -0
- package/scss/components/ConditionBuilder/_index.scss +8 -0
- package/scss/components/CreateFullPage/_create-full-page.scss +10 -10
- package/scss/components/Datagrid/styles/_useNestedRows.scss +5 -1
- package/scss/components/FilterPanel/_carbon-imports.scss +5 -0
- package/scss/components/FilterPanel/_filter-panel-accordion-item.scss +54 -0
- package/scss/components/FilterPanel/_filter-panel-accordion.scss +6 -0
- package/scss/components/FilterPanel/_filter-panel-checkbox-with-overflow.scss +60 -0
- package/scss/components/FilterPanel/_filter-panel-checkbox.scss +24 -3
- package/scss/components/FilterPanel/_filter-panel-group.scss +39 -0
- package/scss/components/FilterPanel/_filter-panel-label.scss +0 -8
- package/scss/components/FilterPanel/_filter-panel-search.scss +38 -0
- package/scss/components/FilterPanel/_filter-panel.scss +2 -0
- package/scss/components/FilterPanel/_index-with-carbon.scss +5 -0
- package/scss/components/FilterPanel/_index.scss +5 -0
- package/scss/components/Guidebanner/_guidebanner.scss +1 -1
- package/scss/components/InlineTip/_inline-tip.scss +1 -1
- package/scss/components/ProductiveCard/_productive-card.scss +13 -0
- package/scss/components/ScrollGradient/_carbon-imports.scss +9 -0
- package/scss/components/ScrollGradient/_index-with-carbon.scss +9 -0
- package/scss/components/ScrollGradient/_index.scss +8 -0
- package/scss/components/ScrollGradient/_scroll-gradient.scss +102 -0
- package/scss/components/SidePanel/_side-panel.scss +9 -9
- package/scss/components/TagOverflow/_carbon-imports.scss +9 -0
- package/scss/components/TagOverflow/_index-with-carbon.scss +9 -0
- package/scss/components/TagOverflow/_index.scss +8 -0
- package/scss/components/TagOverflow/_tag-overflow.scss +55 -0
- package/scss/components/Tearsheet/_tearsheet.scss +10 -0
- package/scss/components/UserAvatar/_user-avatar.scss +38 -4
- package/scss/components/_index-with-carbon.scss +3 -0
- package/scss/components/_index.scss +3 -0
@@ -1,5 +1,84 @@
|
|
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 React, { ReactNode } from 'react';
|
8
|
+
interface CreateSidePanelProps {
|
9
|
+
/**
|
10
|
+
* Provide an optional class to be applied to the containing node.
|
11
|
+
*/
|
12
|
+
className?: string;
|
13
|
+
/**
|
14
|
+
* The description of the CreateSidePanel serves to provide more information about the form within the panel.
|
15
|
+
*/
|
16
|
+
description?: ReactNode;
|
17
|
+
/**
|
18
|
+
* Specifies a boolean for disabling or enabling the primary button. This is important for form validation
|
19
|
+
* Returning `true` prevents the primary button from being clicked until required fields are completed.
|
20
|
+
*/
|
21
|
+
disableSubmit?: boolean;
|
22
|
+
/**
|
23
|
+
* Specifies an optional field that provides a additional context for a form
|
24
|
+
*/
|
25
|
+
formDescription?: ReactNode;
|
26
|
+
/**
|
27
|
+
* Specifies a required field that provides a title for a form
|
28
|
+
*/
|
29
|
+
formTitle: ReactNode;
|
30
|
+
/**
|
31
|
+
* Unique identifier
|
32
|
+
*/
|
33
|
+
id?: string;
|
34
|
+
/**
|
35
|
+
* Specifies an optional handler which is called when the CreateSidePanel
|
36
|
+
* is closed.
|
37
|
+
*/
|
38
|
+
onRequestClose?(): void;
|
39
|
+
/**
|
40
|
+
* Specifies an optional handler which is called when the CreateSidePanel
|
41
|
+
* primary button is pressed.
|
42
|
+
*/
|
43
|
+
onRequestSubmit?(): void;
|
44
|
+
/**
|
45
|
+
* Specifies whether the CreateSidePanel is open or not.
|
46
|
+
*/
|
47
|
+
open: boolean;
|
48
|
+
/**
|
49
|
+
* Specifies the primary button's text in the modal.
|
50
|
+
*/
|
51
|
+
primaryButtonText: string;
|
52
|
+
/**
|
53
|
+
* Specifies the secondary button's text in the modal.
|
54
|
+
*/
|
55
|
+
secondaryButtonText: string;
|
56
|
+
/**
|
57
|
+
* This is the selector to the element that contains all of the page content that will shrink when the panel is a slide in.
|
58
|
+
* This prop is required since create flows use the `slideIn` variant of the side panel.
|
59
|
+
*/
|
60
|
+
selectorPageContent: string;
|
61
|
+
/**
|
62
|
+
* Specifies which DOM element in the form should be focused.
|
63
|
+
*/
|
64
|
+
selectorPrimaryFocus: string;
|
65
|
+
/**
|
66
|
+
* **Experimental:** Provide a `Slug` component to be rendered inside the `SidePanel` component
|
67
|
+
*/
|
68
|
+
slug?: ReactNode;
|
69
|
+
/**
|
70
|
+
* The subtitle of the CreateSidePanel is optional and serves to provide more information about the modal.
|
71
|
+
*/
|
72
|
+
subtitle?: ReactNode;
|
73
|
+
/**
|
74
|
+
* The title of the CreateSidePanel is usually the product or service name.
|
75
|
+
*/
|
76
|
+
title: string;
|
77
|
+
}
|
1
78
|
/**
|
2
79
|
* Use with medium complexity creations if the user needs page context. On-page content can be seen and interacted with.
|
3
80
|
*/
|
4
|
-
export let CreateSidePanel: React.ForwardRefExoticComponent<
|
5
|
-
|
81
|
+
export declare let CreateSidePanel: React.ForwardRefExoticComponent<CreateSidePanelProps & {
|
82
|
+
children?: React.ReactNode;
|
83
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
84
|
+
export {};
|
@@ -47,7 +47,7 @@ var CreateSidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
|
|
47
47
|
label: primaryButtonText,
|
48
48
|
onClick: function onClick(event) {
|
49
49
|
event.preventDefault();
|
50
|
-
onRequestSubmit();
|
50
|
+
onRequestSubmit === null || onRequestSubmit === void 0 || onRequestSubmit();
|
51
51
|
},
|
52
52
|
kind: 'primary',
|
53
53
|
disabled: disableSubmit,
|
@@ -90,6 +90,7 @@ CreateSidePanel.propTypes = {
|
|
90
90
|
/**
|
91
91
|
* Sets the body content of the create side panel
|
92
92
|
*/
|
93
|
+
/**@ts-ignore*/
|
93
94
|
children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]).isRequired,
|
94
95
|
/**
|
95
96
|
* Provide an optional class to be applied to the containing node.
|
@@ -129,6 +130,7 @@ CreateSidePanel.propTypes = {
|
|
129
130
|
/**
|
130
131
|
* Specifies whether the CreateSidePanel is open or not.
|
131
132
|
*/
|
133
|
+
/**@ts-ignore*/
|
132
134
|
open: PropTypes.bool,
|
133
135
|
/**
|
134
136
|
* Specifies the primary button's text in the modal.
|
@@ -146,6 +148,7 @@ CreateSidePanel.propTypes = {
|
|
146
148
|
/**
|
147
149
|
* Specifies which DOM element in the form should be focused.
|
148
150
|
*/
|
151
|
+
/**@ts-ignore*/
|
149
152
|
selectorPrimaryFocus: PropTypes.node.isRequired,
|
150
153
|
/**
|
151
154
|
* **Experimental:** Provide a `Slug` component to be rendered inside the `SidePanel` component
|
@@ -158,7 +161,7 @@ CreateSidePanel.propTypes = {
|
|
158
161
|
/**
|
159
162
|
* The title of the CreateSidePanel is usually the product or service name.
|
160
163
|
*/
|
161
|
-
title: PropTypes.
|
164
|
+
title: PropTypes.string.isRequired
|
162
165
|
};
|
163
166
|
|
164
167
|
export { CreateSidePanel };
|
@@ -1,6 +1,86 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2021, 2021
|
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 React, { PropsWithChildren, ReactNode } from 'react';
|
8
|
+
type VerticalPosition = 'normal' | 'lower';
|
9
|
+
interface CreateTearsheetNarrowProps extends PropsWithChildren {
|
10
|
+
/**
|
11
|
+
* Provide the contents of the CreateTearsheetNarrow.
|
12
|
+
*/
|
13
|
+
children: ReactNode;
|
14
|
+
/**
|
15
|
+
* Provide an optional class to be applied to the containing node.
|
16
|
+
*/
|
17
|
+
className?: string;
|
18
|
+
/**
|
19
|
+
* A description of the flow, displayed in the header area of the tearsheet.
|
20
|
+
*/
|
21
|
+
description?: ReactNode;
|
22
|
+
/**
|
23
|
+
* Specifies a boolean for disabling or enabling the primary button. This is important for form validation
|
24
|
+
* Returning `true` prevents the primary button from being clicked until required fields are completed.
|
25
|
+
*/
|
26
|
+
disableSubmit?: boolean;
|
27
|
+
/**
|
28
|
+
* Specifies an optional field that provides a additional context for a form
|
29
|
+
*/
|
30
|
+
formDescription?: ReactNode;
|
31
|
+
/**
|
32
|
+
* Specifies a field that provides a title for a form
|
33
|
+
*/
|
34
|
+
formTitle?: ReactNode;
|
35
|
+
/**
|
36
|
+
* A label for the tearsheet, displayed in the header area of the tearsheet
|
37
|
+
* to maintain context for the tearsheet (e.g. as the title changes from page
|
38
|
+
* to page of a multi-page task).
|
39
|
+
*/
|
40
|
+
label?: ReactNode;
|
41
|
+
/**
|
42
|
+
* An optional handler that is called when the user closes the tearsheet (by
|
43
|
+
* clicking the close button, if enabled, or clicking outside, if enabled).
|
44
|
+
* Returning `false` here prevents the modal from closing.
|
45
|
+
*/
|
46
|
+
onRequestClose?: () => void;
|
47
|
+
/**
|
48
|
+
* Specifies an optional handler which is called when the CreateTearsheetNarrow
|
49
|
+
* primary button is pressed.
|
50
|
+
*/
|
51
|
+
onRequestSubmit?: () => void;
|
52
|
+
/**
|
53
|
+
* Specifies whether the tearsheet is currently open.
|
54
|
+
*/
|
55
|
+
open?: boolean;
|
56
|
+
/**
|
57
|
+
* Specifies the primary button's text in the CreateTearsheetNarrow.
|
58
|
+
*/
|
59
|
+
primaryButtonText: string;
|
60
|
+
/**
|
61
|
+
* Specifies the secondary button's text in the CreateTearsheetNarrow.
|
62
|
+
*/
|
63
|
+
secondaryButtonText: string;
|
64
|
+
/**
|
65
|
+
* Specifies which DOM element in the form should be focused.
|
66
|
+
*/
|
67
|
+
selectorPrimaryFocus?: ReactNode;
|
68
|
+
/**
|
69
|
+
* The main title of the tearsheet, displayed in the header area.
|
70
|
+
*/
|
71
|
+
title?: ReactNode;
|
72
|
+
/**
|
73
|
+
* The position of the top of tearsheet in the viewport. The 'normal'
|
74
|
+
* position (the default) is a short distance down from the top of the
|
75
|
+
* viewport, leaving room at the top for a global header bar to show through
|
76
|
+
* from below. The 'lower' position provides a little extra room at the top
|
77
|
+
* to allow an action bar navigation or breadcrumbs to also show through.
|
78
|
+
*/
|
79
|
+
verticalPosition?: VerticalPosition;
|
80
|
+
}
|
1
81
|
/**
|
2
82
|
* Use a narrow tearsheet as an alternative to a modal when there is scrolling.
|
3
83
|
* Use when the form fields can be broken down into sections using section headers.
|
4
84
|
*/
|
5
|
-
export let CreateTearsheetNarrow: React.ForwardRefExoticComponent<React.RefAttributes<
|
6
|
-
|
85
|
+
export declare let CreateTearsheetNarrow: React.ForwardRefExoticComponent<CreateTearsheetNarrowProps & React.RefAttributes<unknown>>;
|
86
|
+
export {};
|
@@ -19,14 +19,11 @@ import uuidv4 from '../../global/js/utils/uuidv4.js';
|
|
19
19
|
import { deepCloneObject } from '../../global/js/utils/deepCloneObject.js';
|
20
20
|
import { createActiveCellFn } from './utils/createActiveCellFn.js';
|
21
21
|
import { getCellSize } from './utils/getCellSize.js';
|
22
|
-
import { includesShift, handleMultipleKeys, includesResourceKey } from './utils/handleMultipleKeys.js';
|
23
22
|
import { handleHeaderCellSelection } from './utils/handleHeaderCellSelection.js';
|
24
23
|
import { removeCellSelections } from './utils/removeCellSelections.js';
|
25
24
|
import { selectAllCells } from './utils/selectAllCells.js';
|
26
25
|
import { handleEditSubmit } from './utils/handleEditSubmit.js';
|
27
|
-
import {
|
28
|
-
import { handleActiveCellInSelectionTab } from './utils/handleActiveCellInSelectionTab.js';
|
29
|
-
import { handleCellDeletion } from './utils/handleCellDeletion.js';
|
26
|
+
import { handleKeyPress } from './utils/commonEventHandlers.js';
|
30
27
|
import { useActiveElement } from '../../global/js/hooks/useActiveElement.js';
|
31
28
|
import { usePreviousValue } from '../../global/js/hooks/usePreviousValue.js';
|
32
29
|
import { useMultipleKeyTracking } from './hooks/useMultipleKeyTracking.js';
|
@@ -36,7 +33,6 @@ import { useMoveActiveCell } from './hooks/useMoveActiveCell.js';
|
|
36
33
|
import { useSpreadsheetEdit } from './hooks/useSpreadsheetEdit.js';
|
37
34
|
|
38
35
|
var _excluded = ["cellSize", "className", "columns", "data", "defaultEmptyRowCount", "onDataUpdate", "id", "onActiveCellChange", "onSelectionAreaChange", "selectAllAriaLabel", "spreadsheetAriaLabel", "theme", "totalVisibleColumns"];
|
39
|
-
// cspell:words rowcount colcount
|
40
36
|
|
41
37
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
42
38
|
var blockClass = "".concat(pkg.prefix, "--data-spreadsheet");
|
@@ -404,117 +400,8 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
|
|
404
400
|
});
|
405
401
|
}
|
406
402
|
}, [handleInitialArrowPress, updateActiveCellCoordinates, activeCellCoordinates, columns, rows]);
|
407
|
-
var
|
408
|
-
|
409
|
-
// Command keys need to be returned as there is default browser behavior with these keys
|
410
|
-
// Needs to be returned in editing mode
|
411
|
-
if (checkForReturnCondition(key)) {
|
412
|
-
return;
|
413
|
-
}
|
414
|
-
|
415
|
-
// Clear out all cell selection areas if user uses any arrow key, except if the shift key is being held
|
416
|
-
if (['ArrowLeft', 'ArrowUp', 'ArrowRight', 'ArrowDown'].indexOf(key) > -1) {
|
417
|
-
if (selectionAreas !== null && selectionAreas !== void 0 && selectionAreas.length && keysPressedList.length < 2 && !includesShift(keysPressedList)) {
|
418
|
-
setSelectionAreas([]);
|
419
|
-
setSelectionAreaData([]);
|
420
|
-
removeCellSelections({
|
421
|
-
spreadsheetRef: spreadsheetRef
|
422
|
-
});
|
423
|
-
}
|
424
|
-
}
|
425
|
-
if ((keysPressedList === null || keysPressedList === void 0 ? void 0 : keysPressedList.length) > 1) {
|
426
|
-
handleMultipleKeys({
|
427
|
-
activeCellCoordinates: activeCellCoordinates,
|
428
|
-
event: event,
|
429
|
-
keysPressedList: keysPressedList,
|
430
|
-
selectionAreas: selectionAreas,
|
431
|
-
currentMatcher: currentMatcher,
|
432
|
-
rows: rows,
|
433
|
-
setSelectionAreas: setSelectionAreas,
|
434
|
-
columns: columns,
|
435
|
-
updateActiveCellCoordinates: updateActiveCellCoordinates,
|
436
|
-
spreadsheetRef: spreadsheetRef,
|
437
|
-
removeCellSelections: removeCellSelections,
|
438
|
-
blockClass: blockClass,
|
439
|
-
setCurrentMatcher: setCurrentMatcher,
|
440
|
-
usingMac: usingMac
|
441
|
-
});
|
442
|
-
}
|
443
|
-
|
444
|
-
// Allow arrow key navigation if there are less than two activeKeys OR
|
445
|
-
// if one of the activeCellCoordinates is in a header position
|
446
|
-
// Prevent arrow keys, home key, and end key from scrolling the page when the data spreadsheet container has focus
|
447
|
-
|
448
|
-
if (keysPressedList.length < 2 && !includesShift(keysPressedList) || activeCellCoordinates.row === 'header' || activeCellCoordinates.column === 'header') {
|
449
|
-
switch (key) {
|
450
|
-
case 'Backspace':
|
451
|
-
case 'Delete':
|
452
|
-
{
|
453
|
-
var deleteParams = {
|
454
|
-
selectionAreas: selectionAreas,
|
455
|
-
currentMatcher: currentMatcher,
|
456
|
-
rows: rows,
|
457
|
-
setActiveCellContent: setActiveCellContent,
|
458
|
-
updateData: updateData,
|
459
|
-
activeCellCoordinates: activeCellCoordinates
|
460
|
-
};
|
461
|
-
handleCellDeletion(deleteParams);
|
462
|
-
break;
|
463
|
-
}
|
464
|
-
// Enter
|
465
|
-
case 'Enter':
|
466
|
-
{
|
467
|
-
handleActiveCellInSelectionEnter({
|
468
|
-
activeCellInsideSelectionArea: activeCellInsideSelectionArea,
|
469
|
-
activeCellCoordinates: activeCellCoordinates,
|
470
|
-
activeCellRef: activeCellRef,
|
471
|
-
selectionAreas: selectionAreas,
|
472
|
-
updateActiveCellCoordinates: updateActiveCellCoordinates
|
473
|
-
});
|
474
|
-
break;
|
475
|
-
}
|
476
|
-
// HOME
|
477
|
-
case 'Home':
|
478
|
-
case 'End':
|
479
|
-
{
|
480
|
-
event.preventDefault();
|
481
|
-
if (includesResourceKey(keysPressedList, usingMac)) {
|
482
|
-
return;
|
483
|
-
}
|
484
|
-
handleHomeEndKey({
|
485
|
-
type: key
|
486
|
-
});
|
487
|
-
break;
|
488
|
-
}
|
489
|
-
// Tab
|
490
|
-
case 'Tab':
|
491
|
-
{
|
492
|
-
if (activeCellInsideSelectionArea) {
|
493
|
-
event.preventDefault();
|
494
|
-
return handleActiveCellInSelectionTab({
|
495
|
-
activeCellInsideSelectionArea: activeCellInsideSelectionArea,
|
496
|
-
activeCellCoordinates: activeCellCoordinates,
|
497
|
-
activeCellRef: activeCellRef,
|
498
|
-
selectionAreas: selectionAreas,
|
499
|
-
updateActiveCellCoordinates: updateActiveCellCoordinates
|
500
|
-
});
|
501
|
-
}
|
502
|
-
setSelectionAreas([]);
|
503
|
-
removeActiveCell();
|
504
|
-
removeCellEditor();
|
505
|
-
setContainerHasFocus(false);
|
506
|
-
setActiveCellCoordinates(null);
|
507
|
-
break;
|
508
|
-
}
|
509
|
-
case 'ArrowLeft':
|
510
|
-
case 'ArrowUp':
|
511
|
-
case 'ArrowRight':
|
512
|
-
case 'ArrowDown':
|
513
|
-
{
|
514
|
-
handleArrowKeyPress(key);
|
515
|
-
}
|
516
|
-
}
|
517
|
-
}
|
403
|
+
var handleKeyPressEvent = useCallback(function (event) {
|
404
|
+
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);
|
518
405
|
}, [activeCellInsideSelectionArea, updateActiveCellCoordinates, activeCellCoordinates, removeActiveCell, columns, rows, spreadsheetRef, currentMatcher, removeCellEditor, selectionAreas, handleHomeEndKey, keysPressedList, usingMac, updateData, checkForReturnCondition, handleArrowKeyPress]);
|
519
406
|
var startEditMode = function startEditMode() {
|
520
407
|
setIsEditing(true);
|
@@ -678,6 +565,7 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
|
|
678
565
|
var handleActiveCellMouseEnter = useCallback(function () {
|
679
566
|
handleActiveCellMouseEnterCallback(selectionAreas, clickAndHoldActive);
|
680
567
|
}, [clickAndHoldActive, selectionAreas, handleActiveCellMouseEnterCallback]);
|
568
|
+
// cspell:words rowcount colcount
|
681
569
|
return /*#__PURE__*/React__default.createElement("div", _extends({}, rest, getTableProps(), getDevtoolsProps(componentName), {
|
682
570
|
className: cx(blockClass, className, "".concat(blockClass, "--interactive-cell-element"), _defineProperty(_defineProperty({}, "".concat(blockClass, "__container-has-focus"), containerHasFocus), "".concat(blockClass, "__").concat(theme), theme === 'dark')),
|
683
571
|
ref: spreadsheetRef,
|
@@ -686,7 +574,7 @@ var DataSpreadsheet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref
|
|
686
574
|
"aria-rowcount": (rows === null || rows === void 0 ? void 0 : rows.length) || 0,
|
687
575
|
"aria-colcount": (columns === null || columns === void 0 ? void 0 : columns.length) || 0,
|
688
576
|
"aria-label": spreadsheetAriaLabel,
|
689
|
-
onKeyDown:
|
577
|
+
onKeyDown: handleKeyPressEvent,
|
690
578
|
onFocus: function onFocus() {
|
691
579
|
return setContainerHasFocus(true);
|
692
580
|
}
|
@@ -13,14 +13,12 @@ import cx from 'classnames';
|
|
13
13
|
import { px } from '@carbon/layout';
|
14
14
|
import { pkg } from '../../settings.js';
|
15
15
|
import { deepCloneObject } from '../../global/js/utils/deepCloneObject.js';
|
16
|
-
import uuidv4 from '../../global/js/utils/uuidv4.js';
|
17
16
|
import { removeCellSelections } from './utils/removeCellSelections.js';
|
18
17
|
import { createCellSelectionArea } from './utils/createCellSelectionArea.js';
|
19
18
|
import { checkActiveHeaderCell } from './utils/checkActiveHeaderCell.js';
|
20
19
|
import { checkSelectedHeaderCell } from './utils/checkSelectedHeaderCell.js';
|
21
|
-
import { handleHeaderCellSelection } from './utils/handleHeaderCellSelection.js';
|
22
20
|
import { getSpreadsheetWidth } from './utils/getSpreadsheetWidth.js';
|
23
|
-
import {
|
21
|
+
import { handleBodyCellClick, handleBodyCellHover, handleRowHeaderClick } from './utils/commonEventHandlers.js';
|
24
22
|
import { usePreviousValue } from '../../global/js/hooks/usePreviousValue.js';
|
25
23
|
import { useSpreadsheetMouseUp } from './hooks/useSpreadsheetMouseUp.js';
|
26
24
|
|
@@ -241,71 +239,10 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
241
239
|
|
242
240
|
// onClick fn for each cell in the data spreadsheet body,
|
243
241
|
// adds the active cell highlight
|
244
|
-
var handleBodyCellClick = useCallback(function (cell, columnIndex) {
|
245
|
-
return function (event) {
|
246
|
-
event.preventDefault();
|
247
|
-
var closestBodyCell = event.target.closest(".".concat(blockClass, "__body--td"));
|
248
|
-
var isValidSelectionAreaStart = closestBodyCell.classList.contains("".concat(blockClass, "__body--td"));
|
249
|
-
setValidStartingPoint(isValidSelectionAreaStart);
|
250
|
-
var isHoldingCommandKey = checkForHoldingKey(event, 'cmd');
|
251
|
-
var isHoldingShiftKey = checkForHoldingKey(event, 'shiftKey');
|
252
|
-
setContainerHasFocus(true);
|
253
|
-
var activeCoordinates = {
|
254
|
-
row: cell.row.index,
|
255
|
-
column: columnIndex
|
256
|
-
};
|
257
|
-
var tempMatcher = uuidv4();
|
258
|
-
setClickAndHoldActive(true);
|
259
242
|
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
var activeCellElement = ref.current.querySelector(".".concat(blockClass, "__active-cell--highlight"));
|
264
|
-
activeCellElement.setAttribute('data-selection-id', tempMatcher);
|
265
|
-
setActiveCellInsideSelectionArea(true);
|
266
|
-
setActiveCellCoordinates(activeCoordinates);
|
267
|
-
setCurrentMatcher(tempMatcher);
|
268
|
-
setSelectionAreas(function (prev) {
|
269
|
-
return [].concat(_toConsumableArray(prev), [{
|
270
|
-
point1: activeCoordinates,
|
271
|
-
matcher: tempMatcher
|
272
|
-
}]);
|
273
|
-
});
|
274
|
-
} else if (isHoldingShiftKey) {
|
275
|
-
setContainerHasFocus(true);
|
276
|
-
var selectionAreaClone = deepCloneObject(selectionAreas);
|
277
|
-
var indexOfItemToUpdate = selectionAreaClone.findIndex(function (item) {
|
278
|
-
return item.matcher === currentMatcher;
|
279
|
-
});
|
280
|
-
if (indexOfItemToUpdate === -1) {
|
281
|
-
// There is always a selectionArea with a point1 object that updates
|
282
|
-
// whenever the activeCellCoordinates update, we should always be able
|
283
|
-
// to find an index, but if we do not for some reason we should return
|
284
|
-
// at this point.
|
285
|
-
return;
|
286
|
-
} else {
|
287
|
-
// Update the selectionArea that was found, do not update currentMatcher
|
288
|
-
selectionAreaClone[indexOfItemToUpdate].point1 = activeCellCoordinates;
|
289
|
-
selectionAreaClone[indexOfItemToUpdate].point2 = activeCoordinates;
|
290
|
-
selectionAreaClone[indexOfItemToUpdate].areaCreated = false;
|
291
|
-
selectionAreaClone[indexOfItemToUpdate].matcher = currentMatcher;
|
292
|
-
setSelectionAreas(selectionAreaClone);
|
293
|
-
}
|
294
|
-
} else {
|
295
|
-
activeCellRef.current.style.display = 'none';
|
296
|
-
setActiveCellInsideSelectionArea(false);
|
297
|
-
setActiveCellCoordinates(activeCoordinates);
|
298
|
-
// remove all previous cell selections
|
299
|
-
removeCellSelections({
|
300
|
-
spreadsheetRef: ref
|
301
|
-
});
|
302
|
-
setSelectionAreas([{
|
303
|
-
point1: activeCoordinates,
|
304
|
-
matcher: tempMatcher
|
305
|
-
}]);
|
306
|
-
setCurrentMatcher(tempMatcher);
|
307
|
-
setSelectionAreaData([]);
|
308
|
-
}
|
243
|
+
var handleBodyCellClickEvent = useCallback(function (cell, columnIndex) {
|
244
|
+
return function (event) {
|
245
|
+
handleBodyCellClick(cell, columnIndex, event, currentMatcher, activeCellCoordinates, selectionAreas, setActiveCellCoordinates, setSelectionAreas, setContainerHasFocus, setClickAndHoldActive, setCurrentMatcher, ref, setSelectionAreaData, setActiveCellInsideSelectionArea, activeCellRef, setValidStartingPoint);
|
309
246
|
};
|
310
247
|
}, [currentMatcher, activeCellCoordinates, selectionAreas, setActiveCellCoordinates, setSelectionAreas, setContainerHasFocus, setClickAndHoldActive, setCurrentMatcher, ref, setSelectionAreaData, setActiveCellInsideSelectionArea, activeCellRef]);
|
311
248
|
var handleBodyScroll = function handleBodyScroll() {
|
@@ -321,50 +258,14 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
321
258
|
contentScrollElementRef.removeEventListener('scroll', handleBodyScroll);
|
322
259
|
};
|
323
260
|
});
|
324
|
-
var
|
261
|
+
var handleBodyCellHoverEvent = useCallback(function (cell, columnIndex) {
|
325
262
|
return function () {
|
326
|
-
|
327
|
-
var cellCoordinates = {
|
328
|
-
row: cell.row.index,
|
329
|
-
column: columnIndex
|
330
|
-
};
|
331
|
-
setSelectionAreas(function (prev) {
|
332
|
-
var _selectionAreaClone$i, _selectionAreaClone$i2;
|
333
|
-
var selectionAreaClone = deepCloneObject(prev);
|
334
|
-
var indexOfItemToUpdate = selectionAreaClone.findIndex(function (item) {
|
335
|
-
return item.matcher === currentMatcher;
|
336
|
-
});
|
337
|
-
// No items in the array match up with the currentMatcher value
|
338
|
-
if (indexOfItemToUpdate === -1) {
|
339
|
-
return prev;
|
340
|
-
}
|
341
|
-
// Do not update state if you're still hovering on the same cell
|
342
|
-
if (((_selectionAreaClone$i = selectionAreaClone[indexOfItemToUpdate].point2) === null || _selectionAreaClone$i === void 0 ? void 0 : _selectionAreaClone$i.row) === cellCoordinates.row && ((_selectionAreaClone$i2 = selectionAreaClone[indexOfItemToUpdate].point2) === null || _selectionAreaClone$i2 === void 0 ? void 0 : _selectionAreaClone$i2.column) === cellCoordinates.column) {
|
343
|
-
return prev;
|
344
|
-
}
|
345
|
-
selectionAreaClone[indexOfItemToUpdate].point2 = cellCoordinates;
|
346
|
-
selectionAreaClone[indexOfItemToUpdate].areaCreated = false;
|
347
|
-
return selectionAreaClone;
|
348
|
-
});
|
349
|
-
}
|
263
|
+
handleBodyCellHover(cell, columnIndex, clickAndHoldActive, currentMatcher, setSelectionAreas);
|
350
264
|
};
|
351
265
|
}, [clickAndHoldActive, currentMatcher, setSelectionAreas]);
|
352
|
-
var
|
266
|
+
var handleRowHeaderClickEvent = useCallback(function (index) {
|
353
267
|
return function (event) {
|
354
|
-
|
355
|
-
handleHeaderCellSelection({
|
356
|
-
type: 'row',
|
357
|
-
activeCellCoordinates: activeCellCoordinates,
|
358
|
-
rows: rows,
|
359
|
-
columns: columns,
|
360
|
-
setActiveCellCoordinates: setActiveCellCoordinates,
|
361
|
-
setCurrentMatcher: setCurrentMatcher,
|
362
|
-
setSelectionAreas: setSelectionAreas,
|
363
|
-
spreadsheetRef: ref,
|
364
|
-
index: index,
|
365
|
-
setSelectionAreaData: setSelectionAreaData,
|
366
|
-
isHoldingCommandKey: isHoldingCommandKey
|
367
|
-
});
|
268
|
+
handleRowHeaderClick(index, event, columns, ref, setSelectionAreas, setCurrentMatcher, setActiveCellCoordinates, activeCellCoordinates, rows, setSelectionAreaData);
|
368
269
|
};
|
369
270
|
}, [columns, ref, setSelectionAreas, setCurrentMatcher, setActiveCellCoordinates, activeCellCoordinates, rows, setSelectionAreaData]);
|
370
271
|
|
@@ -414,7 +315,7 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
414
315
|
"data-row-index": index,
|
415
316
|
"data-column-index": "header",
|
416
317
|
type: "button",
|
417
|
-
onClick:
|
318
|
+
onClick: handleRowHeaderClickEvent(index),
|
418
319
|
className: cx("".concat(blockClass, "__td"), "".concat(blockClass, "__td-th"), "".concat(blockClass, "--interactive-cell-element"), _defineProperty(_defineProperty({}, "".concat(blockClass, "__td-th--active-header"), (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === index || checkActiveHeaderCell(index, selectionAreas, 'row')), "".concat(blockClass, "__td-th--selected-header"), checkSelectedHeaderCell(index, selectionAreas, 'row', columns))),
|
419
320
|
style: {
|
420
321
|
width: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeaderWidth
|
@@ -436,14 +337,14 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
436
337
|
"data-row-index": cell.row.index,
|
437
338
|
"data-column-index": index,
|
438
339
|
className: cx("".concat(blockClass, "__td"), "".concat(blockClass, "__body--td"), "".concat(blockClass, "--interactive-cell-element")),
|
439
|
-
onMouseDown:
|
440
|
-
onMouseOver:
|
340
|
+
onMouseDown: handleBodyCellClickEvent(cell, index),
|
341
|
+
onMouseOver: handleBodyCellHoverEvent(cell, index),
|
441
342
|
onFocus: function onFocus() {},
|
442
343
|
type: "button"
|
443
344
|
}, cell.render('Cell')));
|
444
345
|
}));
|
445
346
|
}
|
446
|
-
}, [prepareRow, rows, activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row, selectionAreas,
|
347
|
+
}, [prepareRow, rows, activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row, selectionAreas, handleRowHeaderClickEvent, handleBodyCellClickEvent, handleBodyCellHoverEvent, defaultColumn, columns]);
|
447
348
|
var spreadsheetBodyRef = useRef();
|
448
349
|
return /*#__PURE__*/React__default.createElement("div", _extends({
|
449
350
|
ref: spreadsheetBodyRef,
|
@@ -0,0 +1,4 @@
|
|
1
|
+
export function handleBodyCellClick(cell: any, columnIndex: any, event: any, ...rest: any[]): void;
|
2
|
+
export function handleBodyCellHover(cell: any, columnIndex: any, ...rest: any[]): void;
|
3
|
+
export function handleRowHeaderClick(index: any, event: any, ...rest: any[]): void;
|
4
|
+
export function handleKeyPress(event: any, ...rest: any[]): any;
|