@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
@@ -92,6 +92,24 @@ exports.CreateFullPageStep = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
92
92
|
span: 50
|
93
93
|
}; // Half.
|
94
94
|
|
95
|
+
var renderDescription = function renderDescription() {
|
96
|
+
if (description) {
|
97
|
+
var common = _rollupPluginBabelHelpers.objectSpread2({
|
98
|
+
children: description,
|
99
|
+
className: "".concat(blockClass, "-description")
|
100
|
+
}, span);
|
101
|
+
if (typeof description === 'string') {
|
102
|
+
return /*#__PURE__*/React__default["default"].createElement(react.Column, _rollupPluginBabelHelpers["extends"]({}, common, {
|
103
|
+
as: "p"
|
104
|
+
}));
|
105
|
+
} else if ( /*#__PURE__*/React.isValidElement(description)) {
|
106
|
+
return /*#__PURE__*/React__default["default"].createElement(react.Column, _rollupPluginBabelHelpers["extends"]({}, common, {
|
107
|
+
as: "div"
|
108
|
+
}));
|
109
|
+
}
|
110
|
+
}
|
111
|
+
return null;
|
112
|
+
};
|
95
113
|
return stepsContext ? /*#__PURE__*/React__default["default"].createElement("section", _rollupPluginBabelHelpers["extends"]({}, rest, {
|
96
114
|
className: cx__default["default"](blockClass, className, _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__step--hidden-step"), stepNumber !== (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep)), "".concat(blockClass, "__step--visible-step"), stepNumber === (stepsContext === null || stepsContext === void 0 ? void 0 : stepsContext.currentStep))),
|
97
115
|
ref: ref
|
@@ -101,10 +119,7 @@ exports.CreateFullPageStep = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
101
119
|
}, span), title), subtitle && /*#__PURE__*/React__default["default"].createElement(react.Column, _rollupPluginBabelHelpers["extends"]({
|
102
120
|
className: "".concat(blockClass, "-subtitle"),
|
103
121
|
as: "h6"
|
104
|
-
}, span), subtitle),
|
105
|
-
className: "".concat(blockClass, "-description"),
|
106
|
-
as: "p"
|
107
|
-
}, span), description)))), hasFieldset ? /*#__PURE__*/React__default["default"].createElement(react.FormGroup, {
|
122
|
+
}, span), subtitle), renderDescription()))), hasFieldset ? /*#__PURE__*/React__default["default"].createElement(react.FormGroup, {
|
108
123
|
legendText: fieldsetLegendText,
|
109
124
|
className: "".concat(blockClass, "-fieldset")
|
110
125
|
}, children) : children) : pconsole["default"].warn("You have tried using a ".concat(componentName, " component outside of a CreateFullPage. This is not allowed. ").concat(componentName, "s should always be children of the CreateFullPage"));
|
@@ -124,7 +139,7 @@ exports.CreateFullPageStep.propTypes = {
|
|
124
139
|
/**
|
125
140
|
* Sets an optional description on the progress step component
|
126
141
|
*/
|
127
|
-
description: index["default"].
|
142
|
+
description: index["default"].node,
|
128
143
|
/**
|
129
144
|
* This will conditionally disable the submit button in the multi step CreateFullPage
|
130
145
|
*/
|
@@ -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 {};
|
@@ -56,7 +56,7 @@ exports.CreateSidePanel = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
56
56
|
label: primaryButtonText,
|
57
57
|
onClick: function onClick(event) {
|
58
58
|
event.preventDefault();
|
59
|
-
onRequestSubmit();
|
59
|
+
onRequestSubmit === null || onRequestSubmit === void 0 || onRequestSubmit();
|
60
60
|
},
|
61
61
|
kind: 'primary',
|
62
62
|
disabled: disableSubmit,
|
@@ -99,6 +99,7 @@ exports.CreateSidePanel.propTypes = {
|
|
99
99
|
/**
|
100
100
|
* Sets the body content of the create side panel
|
101
101
|
*/
|
102
|
+
/**@ts-ignore*/
|
102
103
|
children: index["default"].oneOfType([index["default"].arrayOf(index["default"].node), index["default"].node]).isRequired,
|
103
104
|
/**
|
104
105
|
* Provide an optional class to be applied to the containing node.
|
@@ -138,6 +139,7 @@ exports.CreateSidePanel.propTypes = {
|
|
138
139
|
/**
|
139
140
|
* Specifies whether the CreateSidePanel is open or not.
|
140
141
|
*/
|
142
|
+
/**@ts-ignore*/
|
141
143
|
open: index["default"].bool,
|
142
144
|
/**
|
143
145
|
* Specifies the primary button's text in the modal.
|
@@ -155,6 +157,7 @@ exports.CreateSidePanel.propTypes = {
|
|
155
157
|
/**
|
156
158
|
* Specifies which DOM element in the form should be focused.
|
157
159
|
*/
|
160
|
+
/**@ts-ignore*/
|
158
161
|
selectorPrimaryFocus: index["default"].node.isRequired,
|
159
162
|
/**
|
160
163
|
* **Experimental:** Provide a `Slug` component to be rendered inside the `SidePanel` component
|
@@ -167,5 +170,5 @@ exports.CreateSidePanel.propTypes = {
|
|
167
170
|
/**
|
168
171
|
* The title of the CreateSidePanel is usually the product or service name.
|
169
172
|
*/
|
170
|
-
title: index["default"].
|
173
|
+
title: index["default"].string.isRequired
|
171
174
|
};
|
@@ -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 {};
|
@@ -23,14 +23,11 @@ var uuidv4 = require('../../global/js/utils/uuidv4.js');
|
|
23
23
|
var deepCloneObject = require('../../global/js/utils/deepCloneObject.js');
|
24
24
|
var createActiveCellFn = require('./utils/createActiveCellFn.js');
|
25
25
|
var getCellSize = require('./utils/getCellSize.js');
|
26
|
-
var handleMultipleKeys = require('./utils/handleMultipleKeys.js');
|
27
26
|
var handleHeaderCellSelection = require('./utils/handleHeaderCellSelection.js');
|
28
27
|
var removeCellSelections = require('./utils/removeCellSelections.js');
|
29
28
|
var selectAllCells = require('./utils/selectAllCells.js');
|
30
29
|
var handleEditSubmit = require('./utils/handleEditSubmit.js');
|
31
|
-
var
|
32
|
-
var handleActiveCellInSelectionTab = require('./utils/handleActiveCellInSelectionTab.js');
|
33
|
-
var handleCellDeletion = require('./utils/handleCellDeletion.js');
|
30
|
+
var commonEventHandlers = require('./utils/commonEventHandlers.js');
|
34
31
|
var useActiveElement = require('../../global/js/hooks/useActiveElement.js');
|
35
32
|
var usePreviousValue = require('../../global/js/hooks/usePreviousValue.js');
|
36
33
|
var useMultipleKeyTracking = require('./hooks/useMultipleKeyTracking.js');
|
@@ -45,7 +42,6 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
45
42
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
46
43
|
|
47
44
|
var _excluded = ["cellSize", "className", "columns", "data", "defaultEmptyRowCount", "onDataUpdate", "id", "onActiveCellChange", "onSelectionAreaChange", "selectAllAriaLabel", "spreadsheetAriaLabel", "theme", "totalVisibleColumns"];
|
48
|
-
// cspell:words rowcount colcount
|
49
45
|
|
50
46
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
51
47
|
var blockClass = "".concat(settings.pkg.prefix, "--data-spreadsheet");
|
@@ -413,117 +409,8 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
413
409
|
});
|
414
410
|
}
|
415
411
|
}, [handleInitialArrowPress, updateActiveCellCoordinates, activeCellCoordinates, columns, rows]);
|
416
|
-
var
|
417
|
-
|
418
|
-
// Command keys need to be returned as there is default browser behavior with these keys
|
419
|
-
// Needs to be returned in editing mode
|
420
|
-
if (checkForReturnCondition(key)) {
|
421
|
-
return;
|
422
|
-
}
|
423
|
-
|
424
|
-
// Clear out all cell selection areas if user uses any arrow key, except if the shift key is being held
|
425
|
-
if (['ArrowLeft', 'ArrowUp', 'ArrowRight', 'ArrowDown'].indexOf(key) > -1) {
|
426
|
-
if (selectionAreas !== null && selectionAreas !== void 0 && selectionAreas.length && keysPressedList.length < 2 && !handleMultipleKeys.includesShift(keysPressedList)) {
|
427
|
-
setSelectionAreas([]);
|
428
|
-
setSelectionAreaData([]);
|
429
|
-
removeCellSelections.removeCellSelections({
|
430
|
-
spreadsheetRef: spreadsheetRef
|
431
|
-
});
|
432
|
-
}
|
433
|
-
}
|
434
|
-
if ((keysPressedList === null || keysPressedList === void 0 ? void 0 : keysPressedList.length) > 1) {
|
435
|
-
handleMultipleKeys.handleMultipleKeys({
|
436
|
-
activeCellCoordinates: activeCellCoordinates,
|
437
|
-
event: event,
|
438
|
-
keysPressedList: keysPressedList,
|
439
|
-
selectionAreas: selectionAreas,
|
440
|
-
currentMatcher: currentMatcher,
|
441
|
-
rows: rows,
|
442
|
-
setSelectionAreas: setSelectionAreas,
|
443
|
-
columns: columns,
|
444
|
-
updateActiveCellCoordinates: updateActiveCellCoordinates,
|
445
|
-
spreadsheetRef: spreadsheetRef,
|
446
|
-
removeCellSelections: removeCellSelections.removeCellSelections,
|
447
|
-
blockClass: blockClass,
|
448
|
-
setCurrentMatcher: setCurrentMatcher,
|
449
|
-
usingMac: usingMac
|
450
|
-
});
|
451
|
-
}
|
452
|
-
|
453
|
-
// Allow arrow key navigation if there are less than two activeKeys OR
|
454
|
-
// if one of the activeCellCoordinates is in a header position
|
455
|
-
// Prevent arrow keys, home key, and end key from scrolling the page when the data spreadsheet container has focus
|
456
|
-
|
457
|
-
if (keysPressedList.length < 2 && !handleMultipleKeys.includesShift(keysPressedList) || activeCellCoordinates.row === 'header' || activeCellCoordinates.column === 'header') {
|
458
|
-
switch (key) {
|
459
|
-
case 'Backspace':
|
460
|
-
case 'Delete':
|
461
|
-
{
|
462
|
-
var deleteParams = {
|
463
|
-
selectionAreas: selectionAreas,
|
464
|
-
currentMatcher: currentMatcher,
|
465
|
-
rows: rows,
|
466
|
-
setActiveCellContent: setActiveCellContent,
|
467
|
-
updateData: updateData,
|
468
|
-
activeCellCoordinates: activeCellCoordinates
|
469
|
-
};
|
470
|
-
handleCellDeletion.handleCellDeletion(deleteParams);
|
471
|
-
break;
|
472
|
-
}
|
473
|
-
// Enter
|
474
|
-
case 'Enter':
|
475
|
-
{
|
476
|
-
handleActiveCellInSelectionEnter.handleActiveCellInSelectionEnter({
|
477
|
-
activeCellInsideSelectionArea: activeCellInsideSelectionArea,
|
478
|
-
activeCellCoordinates: activeCellCoordinates,
|
479
|
-
activeCellRef: activeCellRef,
|
480
|
-
selectionAreas: selectionAreas,
|
481
|
-
updateActiveCellCoordinates: updateActiveCellCoordinates
|
482
|
-
});
|
483
|
-
break;
|
484
|
-
}
|
485
|
-
// HOME
|
486
|
-
case 'Home':
|
487
|
-
case 'End':
|
488
|
-
{
|
489
|
-
event.preventDefault();
|
490
|
-
if (handleMultipleKeys.includesResourceKey(keysPressedList, usingMac)) {
|
491
|
-
return;
|
492
|
-
}
|
493
|
-
handleHomeEndKey({
|
494
|
-
type: key
|
495
|
-
});
|
496
|
-
break;
|
497
|
-
}
|
498
|
-
// Tab
|
499
|
-
case 'Tab':
|
500
|
-
{
|
501
|
-
if (activeCellInsideSelectionArea) {
|
502
|
-
event.preventDefault();
|
503
|
-
return handleActiveCellInSelectionTab.handleActiveCellInSelectionTab({
|
504
|
-
activeCellInsideSelectionArea: activeCellInsideSelectionArea,
|
505
|
-
activeCellCoordinates: activeCellCoordinates,
|
506
|
-
activeCellRef: activeCellRef,
|
507
|
-
selectionAreas: selectionAreas,
|
508
|
-
updateActiveCellCoordinates: updateActiveCellCoordinates
|
509
|
-
});
|
510
|
-
}
|
511
|
-
setSelectionAreas([]);
|
512
|
-
removeActiveCell();
|
513
|
-
removeCellEditor();
|
514
|
-
setContainerHasFocus(false);
|
515
|
-
setActiveCellCoordinates(null);
|
516
|
-
break;
|
517
|
-
}
|
518
|
-
case 'ArrowLeft':
|
519
|
-
case 'ArrowUp':
|
520
|
-
case 'ArrowRight':
|
521
|
-
case 'ArrowDown':
|
522
|
-
{
|
523
|
-
handleArrowKeyPress(key);
|
524
|
-
}
|
525
|
-
}
|
526
|
-
}
|
412
|
+
var handleKeyPressEvent = React.useCallback(function (event) {
|
413
|
+
commonEventHandlers.handleKeyPress(event, activeCellInsideSelectionArea, updateActiveCellCoordinates, activeCellCoordinates, removeActiveCell, columns, rows, spreadsheetRef, currentMatcher, removeCellEditor, selectionAreas, handleHomeEndKey, keysPressedList, usingMac, updateData, checkForReturnCondition, handleArrowKeyPress, setSelectionAreas, setSelectionAreaData, setCurrentMatcher, activeCellRef, setActiveCellCoordinates, setContainerHasFocus, setActiveCellContent);
|
527
414
|
}, [activeCellInsideSelectionArea, updateActiveCellCoordinates, activeCellCoordinates, removeActiveCell, columns, rows, spreadsheetRef, currentMatcher, removeCellEditor, selectionAreas, handleHomeEndKey, keysPressedList, usingMac, updateData, checkForReturnCondition, handleArrowKeyPress]);
|
528
415
|
var startEditMode = function startEditMode() {
|
529
416
|
setIsEditing(true);
|
@@ -687,6 +574,7 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
687
574
|
var handleActiveCellMouseEnter = React.useCallback(function () {
|
688
575
|
handleActiveCellMouseEnterCallback(selectionAreas, clickAndHoldActive);
|
689
576
|
}, [clickAndHoldActive, selectionAreas, handleActiveCellMouseEnterCallback]);
|
577
|
+
// cspell:words rowcount colcount
|
690
578
|
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({}, rest, getTableProps(), devtools.getDevtoolsProps(componentName), {
|
691
579
|
className: cx__default["default"](blockClass, className, "".concat(blockClass, "--interactive-cell-element"), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__container-has-focus"), containerHasFocus), "".concat(blockClass, "__").concat(theme), theme === 'dark')),
|
692
580
|
ref: spreadsheetRef,
|
@@ -695,7 +583,7 @@ exports.DataSpreadsheet = /*#__PURE__*/React__default["default"].forwardRef(func
|
|
695
583
|
"aria-rowcount": (rows === null || rows === void 0 ? void 0 : rows.length) || 0,
|
696
584
|
"aria-colcount": (columns === null || columns === void 0 ? void 0 : columns.length) || 0,
|
697
585
|
"aria-label": spreadsheetAriaLabel,
|
698
|
-
onKeyDown:
|
586
|
+
onKeyDown: handleKeyPressEvent,
|
699
587
|
onFocus: function onFocus() {
|
700
588
|
return setContainerHasFocus(true);
|
701
589
|
}
|
@@ -17,14 +17,12 @@ var cx = require('classnames');
|
|
17
17
|
var layout = require('@carbon/layout');
|
18
18
|
var settings = require('../../settings.js');
|
19
19
|
var deepCloneObject = require('../../global/js/utils/deepCloneObject.js');
|
20
|
-
var uuidv4 = require('../../global/js/utils/uuidv4.js');
|
21
20
|
var removeCellSelections = require('./utils/removeCellSelections.js');
|
22
21
|
var createCellSelectionArea = require('./utils/createCellSelectionArea.js');
|
23
22
|
var checkActiveHeaderCell = require('./utils/checkActiveHeaderCell.js');
|
24
23
|
var checkSelectedHeaderCell = require('./utils/checkSelectedHeaderCell.js');
|
25
|
-
var handleHeaderCellSelection = require('./utils/handleHeaderCellSelection.js');
|
26
24
|
var getSpreadsheetWidth = require('./utils/getSpreadsheetWidth.js');
|
27
|
-
var
|
25
|
+
var commonEventHandlers = require('./utils/commonEventHandlers.js');
|
28
26
|
var usePreviousValue = require('../../global/js/hooks/usePreviousValue.js');
|
29
27
|
var useSpreadsheetMouseUp = require('./hooks/useSpreadsheetMouseUp.js');
|
30
28
|
|
@@ -250,71 +248,10 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
250
248
|
|
251
249
|
// onClick fn for each cell in the data spreadsheet body,
|
252
250
|
// adds the active cell highlight
|
253
|
-
var handleBodyCellClick = React.useCallback(function (cell, columnIndex) {
|
254
|
-
return function (event) {
|
255
|
-
event.preventDefault();
|
256
|
-
var closestBodyCell = event.target.closest(".".concat(blockClass, "__body--td"));
|
257
|
-
var isValidSelectionAreaStart = closestBodyCell.classList.contains("".concat(blockClass, "__body--td"));
|
258
|
-
setValidStartingPoint(isValidSelectionAreaStart);
|
259
|
-
var isHoldingCommandKey = checkForHoldingKey.checkForHoldingKey(event, 'cmd');
|
260
|
-
var isHoldingShiftKey = checkForHoldingKey.checkForHoldingKey(event, 'shiftKey');
|
261
|
-
setContainerHasFocus(true);
|
262
|
-
var activeCoordinates = {
|
263
|
-
row: cell.row.index,
|
264
|
-
column: columnIndex
|
265
|
-
};
|
266
|
-
var tempMatcher = uuidv4["default"]();
|
267
|
-
setClickAndHoldActive(true);
|
268
251
|
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
var activeCellElement = ref.current.querySelector(".".concat(blockClass, "__active-cell--highlight"));
|
273
|
-
activeCellElement.setAttribute('data-selection-id', tempMatcher);
|
274
|
-
setActiveCellInsideSelectionArea(true);
|
275
|
-
setActiveCellCoordinates(activeCoordinates);
|
276
|
-
setCurrentMatcher(tempMatcher);
|
277
|
-
setSelectionAreas(function (prev) {
|
278
|
-
return [].concat(_rollupPluginBabelHelpers.toConsumableArray(prev), [{
|
279
|
-
point1: activeCoordinates,
|
280
|
-
matcher: tempMatcher
|
281
|
-
}]);
|
282
|
-
});
|
283
|
-
} else if (isHoldingShiftKey) {
|
284
|
-
setContainerHasFocus(true);
|
285
|
-
var selectionAreaClone = deepCloneObject.deepCloneObject(selectionAreas);
|
286
|
-
var indexOfItemToUpdate = selectionAreaClone.findIndex(function (item) {
|
287
|
-
return item.matcher === currentMatcher;
|
288
|
-
});
|
289
|
-
if (indexOfItemToUpdate === -1) {
|
290
|
-
// There is always a selectionArea with a point1 object that updates
|
291
|
-
// whenever the activeCellCoordinates update, we should always be able
|
292
|
-
// to find an index, but if we do not for some reason we should return
|
293
|
-
// at this point.
|
294
|
-
return;
|
295
|
-
} else {
|
296
|
-
// Update the selectionArea that was found, do not update currentMatcher
|
297
|
-
selectionAreaClone[indexOfItemToUpdate].point1 = activeCellCoordinates;
|
298
|
-
selectionAreaClone[indexOfItemToUpdate].point2 = activeCoordinates;
|
299
|
-
selectionAreaClone[indexOfItemToUpdate].areaCreated = false;
|
300
|
-
selectionAreaClone[indexOfItemToUpdate].matcher = currentMatcher;
|
301
|
-
setSelectionAreas(selectionAreaClone);
|
302
|
-
}
|
303
|
-
} else {
|
304
|
-
activeCellRef.current.style.display = 'none';
|
305
|
-
setActiveCellInsideSelectionArea(false);
|
306
|
-
setActiveCellCoordinates(activeCoordinates);
|
307
|
-
// remove all previous cell selections
|
308
|
-
removeCellSelections.removeCellSelections({
|
309
|
-
spreadsheetRef: ref
|
310
|
-
});
|
311
|
-
setSelectionAreas([{
|
312
|
-
point1: activeCoordinates,
|
313
|
-
matcher: tempMatcher
|
314
|
-
}]);
|
315
|
-
setCurrentMatcher(tempMatcher);
|
316
|
-
setSelectionAreaData([]);
|
317
|
-
}
|
252
|
+
var handleBodyCellClickEvent = React.useCallback(function (cell, columnIndex) {
|
253
|
+
return function (event) {
|
254
|
+
commonEventHandlers.handleBodyCellClick(cell, columnIndex, event, currentMatcher, activeCellCoordinates, selectionAreas, setActiveCellCoordinates, setSelectionAreas, setContainerHasFocus, setClickAndHoldActive, setCurrentMatcher, ref, setSelectionAreaData, setActiveCellInsideSelectionArea, activeCellRef, setValidStartingPoint);
|
318
255
|
};
|
319
256
|
}, [currentMatcher, activeCellCoordinates, selectionAreas, setActiveCellCoordinates, setSelectionAreas, setContainerHasFocus, setClickAndHoldActive, setCurrentMatcher, ref, setSelectionAreaData, setActiveCellInsideSelectionArea, activeCellRef]);
|
320
257
|
var handleBodyScroll = function handleBodyScroll() {
|
@@ -330,50 +267,14 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
330
267
|
contentScrollElementRef.removeEventListener('scroll', handleBodyScroll);
|
331
268
|
};
|
332
269
|
});
|
333
|
-
var
|
270
|
+
var handleBodyCellHoverEvent = React.useCallback(function (cell, columnIndex) {
|
334
271
|
return function () {
|
335
|
-
|
336
|
-
var cellCoordinates = {
|
337
|
-
row: cell.row.index,
|
338
|
-
column: columnIndex
|
339
|
-
};
|
340
|
-
setSelectionAreas(function (prev) {
|
341
|
-
var _selectionAreaClone$i, _selectionAreaClone$i2;
|
342
|
-
var selectionAreaClone = deepCloneObject.deepCloneObject(prev);
|
343
|
-
var indexOfItemToUpdate = selectionAreaClone.findIndex(function (item) {
|
344
|
-
return item.matcher === currentMatcher;
|
345
|
-
});
|
346
|
-
// No items in the array match up with the currentMatcher value
|
347
|
-
if (indexOfItemToUpdate === -1) {
|
348
|
-
return prev;
|
349
|
-
}
|
350
|
-
// Do not update state if you're still hovering on the same cell
|
351
|
-
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) {
|
352
|
-
return prev;
|
353
|
-
}
|
354
|
-
selectionAreaClone[indexOfItemToUpdate].point2 = cellCoordinates;
|
355
|
-
selectionAreaClone[indexOfItemToUpdate].areaCreated = false;
|
356
|
-
return selectionAreaClone;
|
357
|
-
});
|
358
|
-
}
|
272
|
+
commonEventHandlers.handleBodyCellHover(cell, columnIndex, clickAndHoldActive, currentMatcher, setSelectionAreas);
|
359
273
|
};
|
360
274
|
}, [clickAndHoldActive, currentMatcher, setSelectionAreas]);
|
361
|
-
var
|
275
|
+
var handleRowHeaderClickEvent = React.useCallback(function (index) {
|
362
276
|
return function (event) {
|
363
|
-
|
364
|
-
handleHeaderCellSelection.handleHeaderCellSelection({
|
365
|
-
type: 'row',
|
366
|
-
activeCellCoordinates: activeCellCoordinates,
|
367
|
-
rows: rows,
|
368
|
-
columns: columns,
|
369
|
-
setActiveCellCoordinates: setActiveCellCoordinates,
|
370
|
-
setCurrentMatcher: setCurrentMatcher,
|
371
|
-
setSelectionAreas: setSelectionAreas,
|
372
|
-
spreadsheetRef: ref,
|
373
|
-
index: index,
|
374
|
-
setSelectionAreaData: setSelectionAreaData,
|
375
|
-
isHoldingCommandKey: isHoldingCommandKey
|
376
|
-
});
|
277
|
+
commonEventHandlers.handleRowHeaderClick(index, event, columns, ref, setSelectionAreas, setCurrentMatcher, setActiveCellCoordinates, activeCellCoordinates, rows, setSelectionAreaData);
|
377
278
|
};
|
378
279
|
}, [columns, ref, setSelectionAreas, setCurrentMatcher, setActiveCellCoordinates, activeCellCoordinates, rows, setSelectionAreaData]);
|
379
280
|
|
@@ -423,7 +324,7 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
423
324
|
"data-row-index": index,
|
424
325
|
"data-column-index": "header",
|
425
326
|
type: "button",
|
426
|
-
onClick:
|
327
|
+
onClick: handleRowHeaderClickEvent(index),
|
427
328
|
className: cx__default["default"]("".concat(blockClass, "__td"), "".concat(blockClass, "__td-th"), "".concat(blockClass, "--interactive-cell-element"), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__td-th--active-header"), (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === index || checkActiveHeaderCell.checkActiveHeaderCell(index, selectionAreas, 'row')), "".concat(blockClass, "__td-th--selected-header"), checkSelectedHeaderCell.checkSelectedHeaderCell(index, selectionAreas, 'row', columns))),
|
428
329
|
style: {
|
429
330
|
width: defaultColumn === null || defaultColumn === void 0 ? void 0 : defaultColumn.rowHeaderWidth
|
@@ -445,14 +346,14 @@ var DataSpreadsheetBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
445
346
|
"data-row-index": cell.row.index,
|
446
347
|
"data-column-index": index,
|
447
348
|
className: cx__default["default"]("".concat(blockClass, "__td"), "".concat(blockClass, "__body--td"), "".concat(blockClass, "--interactive-cell-element")),
|
448
|
-
onMouseDown:
|
449
|
-
onMouseOver:
|
349
|
+
onMouseDown: handleBodyCellClickEvent(cell, index),
|
350
|
+
onMouseOver: handleBodyCellHoverEvent(cell, index),
|
450
351
|
onFocus: function onFocus() {},
|
451
352
|
type: "button"
|
452
353
|
}, cell.render('Cell')));
|
453
354
|
}));
|
454
355
|
}
|
455
|
-
}, [prepareRow, rows, activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row, selectionAreas,
|
356
|
+
}, [prepareRow, rows, activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row, selectionAreas, handleRowHeaderClickEvent, handleBodyCellClickEvent, handleBodyCellHoverEvent, defaultColumn, columns]);
|
456
357
|
var spreadsheetBodyRef = React.useRef();
|
457
358
|
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({
|
458
359
|
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;
|