@carbon/ibm-products 1.27.0 → 1.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/index-full-carbon.css +570 -80
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +3 -3
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +942 -23
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +3 -3
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +569 -79
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +3 -3
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +570 -80
- package/css/index.css.map +1 -1
- package/css/index.min.css +3 -3
- package/css/index.min.css.map +1 -1
- package/es/components/AddSelect/AddSelect.js +0 -3
- package/es/components/AddSelect/AddSelectBody.js +20 -3
- package/es/components/AddSelect/AddSelectBreadcrumbs.js +11 -3
- package/es/components/AddSelect/AddSelectColumn.js +4 -3
- package/es/components/AddSelect/AddSelectFilter.js +4 -3
- package/es/components/AddSelect/AddSelectList.js +40 -14
- package/es/components/Card/Card.js +16 -6
- package/es/components/Card/CardFooter.js +3 -1
- package/es/components/Card/CardHeader.js +20 -1
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +63 -11
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +2 -1
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +7 -0
- package/es/components/DataSpreadsheet/utils/handleCellDeletion.js +31 -0
- package/es/components/DataSpreadsheet/utils/handleMultipleKeys.js +1 -1
- package/es/components/Datagrid/Datagrid/Datagrid.js +10 -38
- package/es/components/Datagrid/Datagrid/DatagridContent.js +127 -0
- package/es/components/Datagrid/Datagrid/DatagridExpandedRow.js +9 -1
- package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +10 -3
- package/es/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +12 -3
- package/es/components/Datagrid/Datagrid/DraggableElement.js +5 -1
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Actions.js +5 -40
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +35 -10
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsModal.js +61 -24
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/ModalWrapper.js +3 -2
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +60 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/index.js +1 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +467 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/index.js +1 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/InlineEditContext.js +112 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/getCellIdAsObject.js +27 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/index.js +1 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/returnUpdatedActiveCell.js +39 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridFocus.js +19 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +263 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleMultipleKeys.js +66 -0
- package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +6 -5
- package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +1 -2
- package/es/components/Datagrid/index.js +3 -1
- package/es/components/Datagrid/useActionsColumn.js +28 -12
- package/es/components/Datagrid/useColumnOrder.js +8 -0
- package/es/components/Datagrid/useCustomizeColumns.js +5 -0
- package/es/components/Datagrid/useDisableSelectRows.js +6 -2
- package/es/components/Datagrid/useExpandedRow.js +0 -1
- package/es/components/Datagrid/useInlineEdit.js +71 -0
- package/es/components/Datagrid/useNestedRowExpander.js +42 -0
- package/es/components/Datagrid/useNestedRows.js +2 -2
- package/es/components/Datagrid/useRowSize.js +17 -6
- package/es/components/Datagrid/useSelectAllToggle.js +17 -4
- package/es/components/Datagrid/useSelectRows.js +12 -2
- package/es/components/Datagrid/useStickyColumn.js +11 -0
- package/es/components/Datagrid/utils/DatagridActions.js +121 -0
- package/es/components/Datagrid/utils/DatagridPagination.js +33 -0
- package/es/components/Datagrid/utils/Wrapper.js +21 -0
- package/es/components/Datagrid/utils/getArgTypes.js +85 -0
- package/es/components/Datagrid/utils/getInlineEditColumns.js +121 -0
- package/es/components/Datagrid/utils/makeData.js +17 -1
- package/es/components/ImportModal/ImportModal.js +2 -2
- package/es/components/InlineEdit/InlineEdit.js +4 -2
- package/es/components/ProductiveCard/ProductiveCard.js +5 -0
- package/es/components/index.js +1 -1
- package/es/global/js/hooks/useClickOutside.js +1 -1
- package/es/global/js/package-settings.js +3 -3
- package/es/global/js/utils/rangeWithCallback.js +13 -0
- package/es/global/js/utils/story-helper.js +5 -1
- package/es/global/js/utils/uuidv4.spec.js +4 -0
- package/lib/components/AddSelect/AddSelect.js +0 -4
- package/lib/components/AddSelect/AddSelectBody.js +20 -3
- package/lib/components/AddSelect/AddSelectBreadcrumbs.js +14 -3
- package/lib/components/AddSelect/AddSelectColumn.js +3 -2
- package/lib/components/AddSelect/AddSelectFilter.js +3 -2
- package/lib/components/AddSelect/AddSelectList.js +39 -13
- package/lib/components/Card/Card.js +16 -6
- package/lib/components/Card/CardFooter.js +3 -1
- package/lib/components/Card/CardHeader.js +21 -1
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +63 -10
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +2 -1
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +7 -0
- package/lib/components/DataSpreadsheet/utils/handleCellDeletion.js +42 -0
- package/lib/components/DataSpreadsheet/utils/handleMultipleKeys.js +1 -1
- package/lib/components/Datagrid/Datagrid/Datagrid.js +12 -45
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +160 -0
- package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.js +9 -1
- package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +12 -3
- package/lib/components/Datagrid/Datagrid/DatagridSelectAllWithToggle.js +14 -3
- package/lib/components/Datagrid/Datagrid/DraggableElement.js +5 -1
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Actions.js +12 -41
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +47 -25
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsModal.js +59 -23
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/ModalWrapper.js +3 -2
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +76 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/index.js +13 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +491 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/index.js +13 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/InlineEditContext.js +129 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/getCellIdAsObject.js +36 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/index.js +19 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/returnUpdatedActiveCell.js +45 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridFocus.js +28 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +272 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleMultipleKeys.js +78 -0
- package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +6 -5
- package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +1 -2
- package/lib/components/Datagrid/index.js +17 -1
- package/lib/components/Datagrid/useActionsColumn.js +28 -13
- package/lib/components/Datagrid/useColumnOrder.js +17 -0
- package/lib/components/Datagrid/useCustomizeColumns.js +5 -0
- package/lib/components/Datagrid/useDisableSelectRows.js +6 -2
- package/lib/components/Datagrid/useExpandedRow.js +0 -1
- package/lib/components/Datagrid/useInlineEdit.js +85 -0
- package/lib/components/Datagrid/useNestedRowExpander.js +57 -0
- package/lib/components/Datagrid/useNestedRows.js +3 -3
- package/lib/components/Datagrid/useRowSize.js +18 -13
- package/lib/components/Datagrid/useSelectAllToggle.js +18 -4
- package/lib/components/Datagrid/useSelectRows.js +12 -2
- package/lib/components/Datagrid/useStickyColumn.js +11 -0
- package/lib/components/Datagrid/utils/DatagridActions.js +139 -0
- package/lib/components/Datagrid/utils/DatagridPagination.js +46 -0
- package/lib/components/Datagrid/utils/Wrapper.js +33 -0
- package/lib/components/Datagrid/utils/getArgTypes.js +93 -0
- package/lib/components/Datagrid/utils/getInlineEditColumns.js +133 -0
- package/lib/components/Datagrid/utils/makeData.js +17 -1
- package/lib/components/ImportModal/ImportModal.js +2 -2
- package/lib/components/InlineEdit/InlineEdit.js +4 -2
- package/lib/components/ProductiveCard/ProductiveCard.js +5 -0
- package/lib/components/index.js +12 -0
- package/lib/global/js/hooks/useClickOutside.js +1 -1
- package/lib/global/js/package-settings.js +3 -3
- package/lib/global/js/utils/rangeWithCallback.js +22 -0
- package/lib/global/js/utils/story-helper.js +5 -1
- package/lib/global/js/utils/uuidv4.spec.js +4 -0
- package/package.json +13 -13
- package/scss/components/AddSelect/_add-select.scss +126 -28
- package/scss/components/Card/_card.scss +1 -0
- package/scss/components/Cascade/_cascade.scss +1 -1
- package/scss/components/CreateTearsheet/_create-tearsheet.scss +1 -0
- package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +18 -1
- package/scss/components/Datagrid/_storybook-styles.scss +1 -1
- package/scss/components/Datagrid/styles/_datagrid.scss +27 -4
- package/scss/components/Datagrid/styles/_draggableElement.scss +26 -9
- package/scss/components/Datagrid/styles/_index.scss +1 -0
- package/scss/components/Datagrid/styles/_useActionsColumn.scss +12 -0
- package/scss/components/Datagrid/styles/_useExpandedRow.scss +30 -0
- package/scss/components/Datagrid/styles/_useInlineEdit.scss +211 -0
- package/scss/components/Datagrid/styles/_useNestedRows.scss +15 -1
- package/scss/components/Datagrid/styles/_useStickyColumn.scss +30 -2
- package/scss/components/Datagrid/styles/addons/_CustomizeColumnsModal.scss +44 -6
- package/scss/components/NotificationsPanel/_notifications-panel.scss +5 -6
- package/scss/components/ProductiveCard/_productive-card.scss +39 -0
- package/scss/components/RemoveModal/_remove-modal.scss +0 -4
- package/scss/components/SidePanel/_side-panel.scss +4 -6
- package/scss/components/_index-released-only.scss +1 -0
|
@@ -12,7 +12,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
12
12
|
// LICENSE file in the root directory of this source tree.
|
|
13
13
|
//
|
|
14
14
|
import React, { useState } from 'react';
|
|
15
|
-
import { Button, ButtonSet, Dropdown,
|
|
15
|
+
import { Button, ButtonSet, Dropdown, Search, Tag } from 'carbon-components-react';
|
|
16
16
|
import cx from 'classnames';
|
|
17
17
|
import PropTypes from 'prop-types';
|
|
18
18
|
import { Filter16 } from '@carbon/icons-react';
|
|
@@ -93,7 +93,7 @@ export var AddSelectFilter = function AddSelectFilter(_ref) {
|
|
|
93
93
|
var dirtyInput = Object.keys(filters).length > 0;
|
|
94
94
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
95
95
|
className: "".concat(blockClass, "-search")
|
|
96
|
-
}, /*#__PURE__*/React.createElement(
|
|
96
|
+
}, /*#__PURE__*/React.createElement(Search, {
|
|
97
97
|
id: "temp-id",
|
|
98
98
|
labelText: inputLabel,
|
|
99
99
|
placeholder: inputPlaceholder,
|
|
@@ -108,7 +108,8 @@ export var AddSelectFilter = function AddSelectFilter(_ref) {
|
|
|
108
108
|
},
|
|
109
109
|
iconDescription: iconDescription,
|
|
110
110
|
className: filterBtnClassnames,
|
|
111
|
-
size: "
|
|
111
|
+
size: "lg",
|
|
112
|
+
tooltipPosition: "left"
|
|
112
113
|
}), open && /*#__PURE__*/React.createElement("div", {
|
|
113
114
|
className: blockClass
|
|
114
115
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -7,7 +7,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
7
7
|
// LICENSE file in the root directory of this source tree.
|
|
8
8
|
//
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import { Button, Checkbox, RadioButton, StructuredListRow, StructuredListWrapper, StructuredListBody,
|
|
10
|
+
import { Button, Checkbox, RadioButton, StructuredListRow, StructuredListWrapper, StructuredListBody, Dropdown } from 'carbon-components-react';
|
|
11
11
|
import { ChevronRight16, View16 } from '@carbon/icons-react';
|
|
12
12
|
import PropTypes from 'prop-types';
|
|
13
13
|
import cx from 'classnames';
|
|
@@ -19,6 +19,7 @@ export var AddSelectList = function AddSelectList(_ref) {
|
|
|
19
19
|
var _modifiers$options;
|
|
20
20
|
|
|
21
21
|
var appliedModifiers = _ref.appliedModifiers,
|
|
22
|
+
displayMetalPanel = _ref.displayMetalPanel,
|
|
22
23
|
filteredItems = _ref.filteredItems,
|
|
23
24
|
metaIconDescription = _ref.metaIconDescription,
|
|
24
25
|
modifiers = _ref.modifiers,
|
|
@@ -38,8 +39,8 @@ export var AddSelectList = function AddSelectList(_ref) {
|
|
|
38
39
|
setSingleSelection(value);
|
|
39
40
|
};
|
|
40
41
|
|
|
41
|
-
var handleMultiSelection = function handleMultiSelection(
|
|
42
|
-
if (
|
|
42
|
+
var handleMultiSelection = function handleMultiSelection(value, id) {
|
|
43
|
+
if (value) {
|
|
43
44
|
var newValues = [].concat(_toConsumableArray(multiSelection), [id]);
|
|
44
45
|
setMultiSelection(newValues);
|
|
45
46
|
} else {
|
|
@@ -58,7 +59,11 @@ export var AddSelectList = function AddSelectList(_ref) {
|
|
|
58
59
|
};
|
|
59
60
|
|
|
60
61
|
var isSelected = function isSelected(id) {
|
|
61
|
-
|
|
62
|
+
if (multi) {
|
|
63
|
+
return multiSelection.includes(id);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return id === singleSelection;
|
|
62
67
|
};
|
|
63
68
|
|
|
64
69
|
var getAvatarProps = function getAvatarProps(_ref3) {
|
|
@@ -94,30 +99,53 @@ export var AddSelectList = function AddSelectList(_ref) {
|
|
|
94
99
|
setAppliedModifiers(modifiersClone);
|
|
95
100
|
};
|
|
96
101
|
|
|
102
|
+
var metaPanelHandler = function metaPanelHandler(item) {
|
|
103
|
+
if (item.meta) {
|
|
104
|
+
setDisplayMetaPanel(item);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
var isInMetaPanel = function isInMetaPanel(id) {
|
|
109
|
+
return id === (displayMetalPanel === null || displayMetalPanel === void 0 ? void 0 : displayMetalPanel.id);
|
|
110
|
+
};
|
|
111
|
+
|
|
97
112
|
return /*#__PURE__*/React.createElement("div", {
|
|
98
|
-
className: "".concat(blockClass, "-wrapper")
|
|
113
|
+
className: cx("".concat(blockClass, "-wrapper"), _defineProperty({}, "".concat(blockClass, "-wrapper-multi"), multi))
|
|
99
114
|
}, /*#__PURE__*/React.createElement(StructuredListWrapper, {
|
|
100
115
|
selection: true,
|
|
101
116
|
className: "".concat(blockClass)
|
|
102
117
|
}, /*#__PURE__*/React.createElement(StructuredListBody, null, filteredItems.map(function (item) {
|
|
118
|
+
var _cx2;
|
|
119
|
+
|
|
103
120
|
return /*#__PURE__*/React.createElement(StructuredListRow, {
|
|
104
121
|
key: item.id,
|
|
105
|
-
className: cx("".concat(blockClass, "-row"),
|
|
106
|
-
|
|
122
|
+
className: cx("".concat(blockClass, "-row"), (_cx2 = {}, _defineProperty(_cx2, "".concat(blockClass, "-row-selected"), isSelected(item.id)), _defineProperty(_cx2, "".concat(blockClass, "-row-meta-selected"), isInMetaPanel(item.id)), _cx2)),
|
|
123
|
+
onClick: function onClick(evt) {
|
|
124
|
+
return metaPanelHandler(item, evt);
|
|
125
|
+
}
|
|
126
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
107
127
|
className: "".concat(blockClass, "-cell")
|
|
108
128
|
}, /*#__PURE__*/React.createElement("div", {
|
|
109
129
|
className: "".concat(blockClass, "-cell-wrapper")
|
|
110
130
|
}, multi ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
111
131
|
className: "".concat(blockClass, "-checkbox")
|
|
132
|
+
},
|
|
133
|
+
/*#__PURE__*/
|
|
134
|
+
// hacky way to prevent checkbox from triggering the meta onclick handler
|
|
135
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
136
|
+
React.createElement("div", {
|
|
137
|
+
onClick: function onClick(event) {
|
|
138
|
+
return event.stopPropagation();
|
|
139
|
+
}
|
|
112
140
|
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
113
|
-
onChange: function onChange(
|
|
114
|
-
return handleMultiSelection(
|
|
141
|
+
onChange: function onChange(value, id) {
|
|
142
|
+
return handleMultiSelection(value, id);
|
|
115
143
|
},
|
|
116
144
|
labelText: item.title,
|
|
117
145
|
id: item.id,
|
|
118
146
|
checked: isSelected(item.id),
|
|
119
147
|
className: "".concat(blockClass, "-checkbox-wrapper")
|
|
120
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
148
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
121
149
|
className: "".concat(blockClass, "-checkbox-label-wrapper")
|
|
122
150
|
}, item.avatar && /*#__PURE__*/React.createElement(UserProfileImage, getAvatarProps(item.avatar)), item.icon && /*#__PURE__*/React.createElement("div", {
|
|
123
151
|
className: "".concat(blockClass, "-cell-icon")
|
|
@@ -149,7 +177,7 @@ export var AddSelectList = function AddSelectList(_ref) {
|
|
|
149
177
|
onChange: function onChange() {
|
|
150
178
|
return handleSingleSelection(item.id);
|
|
151
179
|
},
|
|
152
|
-
|
|
180
|
+
checked: isSelected(item.id)
|
|
153
181
|
}), item.children && /*#__PURE__*/React.createElement(Button, {
|
|
154
182
|
className: "".concat(blockClass, "-view-children"),
|
|
155
183
|
renderIcon: ChevronRight16,
|
|
@@ -171,9 +199,6 @@ export var AddSelectList = function AddSelectList(_ref) {
|
|
|
171
199
|
tooltipPosition: "left",
|
|
172
200
|
tooltipAlignment: "center",
|
|
173
201
|
hasIconOnly: true,
|
|
174
|
-
onClick: function onClick() {
|
|
175
|
-
return setDisplayMetaPanel(item);
|
|
176
|
-
},
|
|
177
202
|
kind: "ghost",
|
|
178
203
|
size: "sm"
|
|
179
204
|
})))));
|
|
@@ -181,6 +206,7 @@ export var AddSelectList = function AddSelectList(_ref) {
|
|
|
181
206
|
};
|
|
182
207
|
AddSelectList.propTypes = {
|
|
183
208
|
appliedModifiers: PropTypes.array,
|
|
209
|
+
displayMetalPanel: PropTypes.object,
|
|
184
210
|
filteredItems: PropTypes.array,
|
|
185
211
|
metaIconDescription: PropTypes.string,
|
|
186
212
|
modifiers: PropTypes.object,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["actionIcons", "actionsPlacement", "children", "className", "clickZone", "description", "label", "media", "mediaPosition", "onClick", "onKeyDown", "onPrimaryButtonClick", "overflowActions", "onSecondaryButtonClick", "pictogram", "primaryButtonHref", "primaryButtonIcon", "primaryButtonKind", "primaryButtonText", "productive", "secondaryButtonHref", "secondaryButtonIcon", "secondaryButtonKind", "secondaryButtonText", "title", "titleSize"],
|
|
4
|
+
var _excluded = ["actionIcons", "actionsPlacement", "children", "className", "clickZone", "description", "label", "media", "mediaPosition", "onClick", "onKeyDown", "onPrimaryButtonClick", "overflowActions", "onSecondaryButtonClick", "pictogram", "primaryButtonHref", "primaryButtonIcon", "primaryButtonKind", "primaryButtonPlacement", "primaryButtonText", "productive", "secondaryButtonHref", "secondaryButtonIcon", "secondaryButtonKind", "secondaryButtonText", "title", "titleSize"],
|
|
5
5
|
_excluded2 = ["id"],
|
|
6
6
|
_excluded3 = ["id", "icon", "onClick", "iconDescription", "onKeyDown", "href"];
|
|
7
7
|
|
|
@@ -31,6 +31,7 @@ var defaults = {
|
|
|
31
31
|
mediaPosition: 'top',
|
|
32
32
|
overflowActions: Object.freeze([]),
|
|
33
33
|
primaryButtonKind: 'primary',
|
|
34
|
+
primaryButtonPlacement: 'bottom',
|
|
34
35
|
productive: false,
|
|
35
36
|
secondaryButtonKind: 'secondary',
|
|
36
37
|
titleSize: 'default'
|
|
@@ -60,6 +61,8 @@ export var Card = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
60
61
|
primaryButtonIcon = _ref.primaryButtonIcon,
|
|
61
62
|
_ref$primaryButtonKin = _ref.primaryButtonKind,
|
|
62
63
|
primaryButtonKind = _ref$primaryButtonKin === void 0 ? defaults.primaryButtonKind : _ref$primaryButtonKin,
|
|
64
|
+
_ref$primaryButtonPla = _ref.primaryButtonPlacement,
|
|
65
|
+
primaryButtonPlacement = _ref$primaryButtonPla === void 0 ? defaults.primaryButtonPlacement : _ref$primaryButtonPla,
|
|
63
66
|
primaryButtonText = _ref.primaryButtonText,
|
|
64
67
|
_ref$productive = _ref.productive,
|
|
65
68
|
productive = _ref$productive === void 0 ? defaults.productive : _ref$productive,
|
|
@@ -74,9 +77,9 @@ export var Card = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
74
77
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
75
78
|
|
|
76
79
|
var blockClass = "".concat(pkg.prefix, "--card");
|
|
77
|
-
var hasActions = actionIcons.length > 0 || overflowActions.length > 0;
|
|
80
|
+
var hasActions = actionIcons.length > 0 || overflowActions.length > 0 || primaryButtonText && primaryButtonPlacement === 'top';
|
|
78
81
|
var hasFooterActions = hasActions && actionsPlacement === 'bottom';
|
|
79
|
-
var hasFooterButton = !!secondaryButtonText || !!primaryButtonText;
|
|
82
|
+
var hasFooterButton = !!secondaryButtonText || !!primaryButtonText && primaryButtonPlacement === 'bottom';
|
|
80
83
|
var hasBottomBar = hasFooterActions || hasFooterButton;
|
|
81
84
|
var hasClickEvent = !!onClick || !!onKeyDown;
|
|
82
85
|
var clickableProps = {
|
|
@@ -177,10 +180,15 @@ export var Card = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
177
180
|
|
|
178
181
|
var getHeaderProps = function getHeaderProps() {
|
|
179
182
|
return {
|
|
180
|
-
actions: getActions(),
|
|
183
|
+
actions: actionsPlacement === 'top' ? getActions() : '',
|
|
184
|
+
noActionIcons: actionIcons.length > 0 && actionsPlacement === 'top' ? false : true,
|
|
181
185
|
actionsPlacement: actionsPlacement,
|
|
186
|
+
onPrimaryButtonClick: onPrimaryButtonClick,
|
|
187
|
+
primaryButtonIcon: primaryButtonIcon,
|
|
188
|
+
primaryButtonPlacement: primaryButtonPlacement,
|
|
189
|
+
primaryButtonText: primaryButtonText,
|
|
182
190
|
description: description,
|
|
183
|
-
hasActions: hasActions
|
|
191
|
+
hasActions: hasActions,
|
|
184
192
|
label: label,
|
|
185
193
|
title: title,
|
|
186
194
|
titleSize: titleSize
|
|
@@ -199,7 +207,7 @@ export var Card = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
199
207
|
|
|
200
208
|
var getFooterProps = function getFooterProps() {
|
|
201
209
|
return {
|
|
202
|
-
actions: getActions(),
|
|
210
|
+
actions: actionsPlacement === 'bottom' ? getActions() : '',
|
|
203
211
|
actionsPlacement: actionsPlacement,
|
|
204
212
|
hasActions: hasFooterActions,
|
|
205
213
|
hasButton: hasFooterButton,
|
|
@@ -208,6 +216,7 @@ export var Card = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
208
216
|
primaryButtonHref: primaryButtonHref,
|
|
209
217
|
primaryButtonIcon: primaryButtonIcon,
|
|
210
218
|
primaryButtonKind: primaryButtonKind,
|
|
219
|
+
primaryButtonPlacement: primaryButtonPlacement,
|
|
211
220
|
primaryButtonText: primaryButtonText,
|
|
212
221
|
productive: productive,
|
|
213
222
|
secondaryButtonHref: secondaryButtonHref,
|
|
@@ -256,6 +265,7 @@ Card.propTypes = {
|
|
|
256
265
|
primaryButtonHref: PropTypes.string,
|
|
257
266
|
primaryButtonIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
258
267
|
primaryButtonKind: PropTypes.oneOf(['primary', 'ghost']),
|
|
268
|
+
primaryButtonPlacement: PropTypes.oneOf(['top', 'bottom']),
|
|
259
269
|
primaryButtonText: PropTypes.node,
|
|
260
270
|
productive: PropTypes.bool,
|
|
261
271
|
secondaryButtonHref: PropTypes.string,
|
|
@@ -28,6 +28,7 @@ export var CardFooter = function CardFooter(_ref) {
|
|
|
28
28
|
primaryButtonIcon = _ref.primaryButtonIcon,
|
|
29
29
|
_ref$primaryButtonKin = _ref.primaryButtonKind,
|
|
30
30
|
primaryButtonKind = _ref$primaryButtonKin === void 0 ? defaults.primaryButtonKind : _ref$primaryButtonKin,
|
|
31
|
+
primaryButtonPlacement = _ref.primaryButtonPlacement,
|
|
31
32
|
primaryButtonText = _ref.primaryButtonText,
|
|
32
33
|
_ref$productive = _ref.productive,
|
|
33
34
|
productive = _ref$productive === void 0 ? defaults.productive : _ref$productive,
|
|
@@ -47,7 +48,7 @@ export var CardFooter = function CardFooter(_ref) {
|
|
|
47
48
|
size: "field",
|
|
48
49
|
renderIcon: secondaryButtonIcon,
|
|
49
50
|
href: secondaryButtonHref
|
|
50
|
-
}, secondaryButtonText), primaryButtonText && /*#__PURE__*/React.createElement(Button, {
|
|
51
|
+
}, secondaryButtonText), primaryButtonText && primaryButtonPlacement === 'bottom' && /*#__PURE__*/React.createElement(Button, {
|
|
51
52
|
kind: productive ? 'ghost' : primaryButtonKind,
|
|
52
53
|
onClick: onPrimaryButtonClick,
|
|
53
54
|
size: "field",
|
|
@@ -66,6 +67,7 @@ CardFooter.propTypes = {
|
|
|
66
67
|
primaryButtonHref: PropTypes.string,
|
|
67
68
|
primaryButtonIcon: PropTypes.string,
|
|
68
69
|
primaryButtonKind: PropTypes.oneOf(['primary', 'ghost']),
|
|
70
|
+
primaryButtonPlacement: PropTypes.oneOf(['top', 'bottom']),
|
|
69
71
|
primaryButtonText: PropTypes.string,
|
|
70
72
|
productive: PropTypes.bool,
|
|
71
73
|
secondaryButtonHref: PropTypes.string,
|
|
@@ -9,6 +9,7 @@ import React from 'react';
|
|
|
9
9
|
import cx from 'classnames';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import { pkg } from '../../settings';
|
|
12
|
+
import { Button } from 'carbon-components-react';
|
|
12
13
|
var componentName = 'CardHeader';
|
|
13
14
|
var defaults = {
|
|
14
15
|
hasActions: false,
|
|
@@ -18,6 +19,11 @@ export var CardHeader = function CardHeader(_ref) {
|
|
|
18
19
|
var _cx;
|
|
19
20
|
|
|
20
21
|
var actions = _ref.actions,
|
|
22
|
+
noActionIcons = _ref.noActionIcons,
|
|
23
|
+
onPrimaryButtonClick = _ref.onPrimaryButtonClick,
|
|
24
|
+
primaryButtonIcon = _ref.primaryButtonIcon,
|
|
25
|
+
primaryButtonPlacement = _ref.primaryButtonPlacement,
|
|
26
|
+
primaryButtonText = _ref.primaryButtonText,
|
|
21
27
|
description = _ref.description,
|
|
22
28
|
_ref$hasActions = _ref.hasActions,
|
|
23
29
|
hasActions = _ref$hasActions === void 0 ? defaults.hasActions : _ref$hasActions,
|
|
@@ -28,6 +34,8 @@ export var CardHeader = function CardHeader(_ref) {
|
|
|
28
34
|
var blockClass = "".concat(pkg.prefix, "--card");
|
|
29
35
|
var headerClass = "".concat(blockClass, "__header");
|
|
30
36
|
var headerClasses = cx(headerClass, (_cx = {}, _defineProperty(_cx, "".concat(headerClass, "-label-only"), label && !title && !description), _defineProperty(_cx, "".concat(headerClass, "-has-label"), !!label), _defineProperty(_cx, "".concat(blockClass, "__title-lg"), titleSize === 'large'), _cx));
|
|
37
|
+
var actionGhostButton = "".concat(blockClass, "__actions-header-ghost-button");
|
|
38
|
+
var actionGhostButtonClass = cx(actionGhostButton, _defineProperty({}, "".concat(actionGhostButton, "--only"), noActionIcons));
|
|
31
39
|
return /*#__PURE__*/React.createElement("div", {
|
|
32
40
|
className: headerClasses
|
|
33
41
|
}, /*#__PURE__*/React.createElement("div", {
|
|
@@ -42,13 +50,24 @@ export var CardHeader = function CardHeader(_ref) {
|
|
|
42
50
|
className: "".concat(blockClass, "__description")
|
|
43
51
|
}, description)), hasActions && /*#__PURE__*/React.createElement("div", {
|
|
44
52
|
className: "".concat(blockClass, "__actions ").concat(blockClass, "__actions-header")
|
|
45
|
-
}, actions
|
|
53
|
+
}, actions, primaryButtonText && primaryButtonPlacement === 'top' && /*#__PURE__*/React.createElement(Button, {
|
|
54
|
+
kind: "ghost",
|
|
55
|
+
size: "small",
|
|
56
|
+
renderIcon: primaryButtonIcon,
|
|
57
|
+
onClick: onPrimaryButtonClick,
|
|
58
|
+
className: actionGhostButtonClass
|
|
59
|
+
}, primaryButtonText))));
|
|
46
60
|
};
|
|
47
61
|
CardHeader.propTypes = {
|
|
48
62
|
actions: PropTypes.oneOfType([PropTypes.array, PropTypes.node]),
|
|
49
63
|
description: PropTypes.string,
|
|
50
64
|
hasActions: PropTypes.bool,
|
|
51
65
|
label: PropTypes.string,
|
|
66
|
+
noActionIcons: PropTypes.bool,
|
|
67
|
+
onPrimaryButtonClick: PropTypes.func,
|
|
68
|
+
primaryButtonIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
69
|
+
primaryButtonPlacement: PropTypes.oneOf(['top', 'bottom']),
|
|
70
|
+
primaryButtonText: PropTypes.string,
|
|
52
71
|
title: PropTypes.string,
|
|
53
72
|
titleSize: PropTypes.oneOf(['default', 'large'])
|
|
54
73
|
};
|
|
@@ -3,7 +3,7 @@ import _typeof from "@babel/runtime/helpers/typeof";
|
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
5
5
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
6
|
-
var _excluded = ["cellSize", "className", "columns", "data", "defaultEmptyRowCount", "onDataUpdate", "id", "onActiveCellChange", "onSelectionAreaChange", "totalVisibleColumns"];
|
|
6
|
+
var _excluded = ["cellSize", "className", "columns", "data", "defaultEmptyRowCount", "onDataUpdate", "id", "onActiveCellChange", "onSelectionAreaChange", "selectAllAriaLabel", "spreadsheetAriaLabel", "theme", "totalVisibleColumns"];
|
|
7
7
|
|
|
8
8
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
9
|
|
|
@@ -39,7 +39,8 @@ import { removeCellSelections } from './utils/removeCellSelections';
|
|
|
39
39
|
import { selectAllCells } from './utils/selectAllCells';
|
|
40
40
|
import { handleEditSubmit } from './utils/handleEditSubmit';
|
|
41
41
|
import { handleActiveCellInSelectionEnter } from './utils/handleActiveCellInSelectionEnter';
|
|
42
|
-
import { handleActiveCellInSelectionTab } from './utils/handleActiveCellInSelectionTab';
|
|
42
|
+
import { handleActiveCellInSelectionTab } from './utils/handleActiveCellInSelectionTab';
|
|
43
|
+
import { handleCellDeletion } from './utils/handleCellDeletion'; // cspell:words rowcount colcount
|
|
43
44
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
|
44
45
|
|
|
45
46
|
var blockClass = "".concat(pkg.prefix, "--data-spreadsheet");
|
|
@@ -52,13 +53,16 @@ var defaults = {
|
|
|
52
53
|
defaultEmptyRowCount: 16,
|
|
53
54
|
onDataUpdate: Object.freeze(function () {}),
|
|
54
55
|
onActiveCellChange: Object.freeze(function () {}),
|
|
55
|
-
onSelectionAreaChange: Object.freeze(function () {})
|
|
56
|
+
onSelectionAreaChange: Object.freeze(function () {}),
|
|
57
|
+
theme: 'light'
|
|
56
58
|
};
|
|
57
59
|
/**
|
|
58
60
|
* DataSpreadsheet: used to organize and display large amounts of structured data, separated by columns and rows in a grid-like format.
|
|
59
61
|
*/
|
|
60
62
|
|
|
61
63
|
export var DataSpreadsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
64
|
+
var _cx;
|
|
65
|
+
|
|
62
66
|
var _ref$cellSize = _ref.cellSize,
|
|
63
67
|
cellSize = _ref$cellSize === void 0 ? defaults.cellSize : _ref$cellSize,
|
|
64
68
|
className = _ref.className,
|
|
@@ -75,6 +79,9 @@ export var DataSpreadsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
|
75
79
|
onActiveCellChange = _ref$onActiveCellChan === void 0 ? defaults.onActiveCellChange : _ref$onActiveCellChan,
|
|
76
80
|
_ref$onSelectionAreaC = _ref.onSelectionAreaChange,
|
|
77
81
|
onSelectionAreaChange = _ref$onSelectionAreaC === void 0 ? defaults.onSelectionAreaChange : _ref$onSelectionAreaC,
|
|
82
|
+
selectAllAriaLabel = _ref.selectAllAriaLabel,
|
|
83
|
+
spreadsheetAriaLabel = _ref.spreadsheetAriaLabel,
|
|
84
|
+
theme = _ref.theme,
|
|
78
85
|
totalVisibleColumns = _ref.totalVisibleColumns,
|
|
79
86
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
80
87
|
|
|
@@ -182,11 +189,11 @@ export var DataSpreadsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
|
182
189
|
visibleColumns = _useTable.visibleColumns; // Update the spreadsheet data after editing a cell
|
|
183
190
|
|
|
184
191
|
|
|
185
|
-
var updateData = useCallback(function (rowIndex, columnId) {
|
|
192
|
+
var updateData = useCallback(function (rowIndex, columnId, newValue) {
|
|
186
193
|
onDataUpdate(function (prev) {
|
|
187
194
|
return prev.map(function (row, index) {
|
|
188
195
|
if (index === rowIndex) {
|
|
189
|
-
return _objectSpread(_objectSpread({}, prev[rowIndex]), {}, _defineProperty({}, columnId, cellEditorValue));
|
|
196
|
+
return _objectSpread(_objectSpread({}, prev[rowIndex]), {}, _defineProperty({}, columnId, cellEditorValue || newValue));
|
|
190
197
|
}
|
|
191
198
|
|
|
192
199
|
return row;
|
|
@@ -374,13 +381,34 @@ export var DataSpreadsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
|
374
381
|
setCurrentMatcher: setCurrentMatcher,
|
|
375
382
|
usingMac: usingMac
|
|
376
383
|
});
|
|
377
|
-
}
|
|
378
|
-
// if one of the activeCellCoordinates is in a header position
|
|
384
|
+
}
|
|
379
385
|
|
|
386
|
+
var deleteParams = {
|
|
387
|
+
selectionAreas: selectionAreas,
|
|
388
|
+
currentMatcher: currentMatcher,
|
|
389
|
+
rows: rows,
|
|
390
|
+
setActiveCellContent: setActiveCellContent,
|
|
391
|
+
updateData: updateData
|
|
392
|
+
}; // Allow arrow key navigation if there are less than two activeKeys OR
|
|
393
|
+
// if one of the activeCellCoordinates is in a header position
|
|
380
394
|
|
|
381
395
|
if (keysPressedList.length < 2 && !includesShift(keysPressedList) || activeCellCoordinates.row === 'header' || activeCellCoordinates.column === 'header') {
|
|
382
396
|
switch (key) {
|
|
397
|
+
// Backspace
|
|
398
|
+
case 'Backspace':
|
|
399
|
+
{
|
|
400
|
+
handleCellDeletion(deleteParams);
|
|
401
|
+
break;
|
|
402
|
+
}
|
|
403
|
+
// Delete
|
|
404
|
+
|
|
405
|
+
case 'Delete':
|
|
406
|
+
{
|
|
407
|
+
handleCellDeletion(deleteParams);
|
|
408
|
+
break;
|
|
409
|
+
}
|
|
383
410
|
// Enter
|
|
411
|
+
|
|
384
412
|
case 'Enter':
|
|
385
413
|
{
|
|
386
414
|
handleActiveCellInSelectionEnter({
|
|
@@ -578,7 +606,7 @@ export var DataSpreadsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
|
578
606
|
}
|
|
579
607
|
}
|
|
580
608
|
}
|
|
581
|
-
}, [activeCellInsideSelectionArea, updateActiveCellCoordinates, handleInitialArrowPress, activeCellCoordinates, removeActiveCell, columns, rows, spreadsheetRef, currentMatcher, isEditing, removeCellEditor, selectionAreas, handleHomeEndKey, keysPressedList, usingMac]);
|
|
609
|
+
}, [activeCellInsideSelectionArea, updateActiveCellCoordinates, handleInitialArrowPress, activeCellCoordinates, removeActiveCell, columns, rows, spreadsheetRef, currentMatcher, isEditing, removeCellEditor, selectionAreas, handleHomeEndKey, keysPressedList, usingMac, updateData]);
|
|
582
610
|
|
|
583
611
|
var startEditMode = function startEditMode() {
|
|
584
612
|
setIsEditing(true);
|
|
@@ -614,6 +642,11 @@ export var DataSpreadsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
|
614
642
|
}
|
|
615
643
|
|
|
616
644
|
return;
|
|
645
|
+
}; // Mouse up on active cell
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
var handleActiveCellMouseUp = function handleActiveCellMouseUp() {
|
|
649
|
+
setClickAndHoldActive(false);
|
|
617
650
|
}; // Mouse down on active cell
|
|
618
651
|
|
|
619
652
|
|
|
@@ -752,12 +785,13 @@ export var DataSpreadsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
|
752
785
|
}
|
|
753
786
|
}, [spreadsheetRef, currentMatcher]);
|
|
754
787
|
return /*#__PURE__*/React.createElement("div", _extends({}, rest, getTableProps(), getDevtoolsProps(componentName), {
|
|
755
|
-
className: cx(blockClass, className, "".concat(blockClass, "--interactive-cell-element"),
|
|
788
|
+
className: cx(blockClass, className, "".concat(blockClass, "--interactive-cell-element"), (_cx = {}, _defineProperty(_cx, "".concat(blockClass, "__container-has-focus"), containerHasFocus), _defineProperty(_cx, "".concat(blockClass, "__").concat(theme), theme === 'dark'), _cx)),
|
|
756
789
|
ref: spreadsheetRef,
|
|
757
790
|
role: "grid",
|
|
758
791
|
tabIndex: 0,
|
|
759
792
|
"aria-rowcount": (rows === null || rows === void 0 ? void 0 : rows.length) || 0,
|
|
760
793
|
"aria-colcount": (columns === null || columns === void 0 ? void 0 : columns.length) || 0,
|
|
794
|
+
"aria-label": spreadsheetAriaLabel,
|
|
761
795
|
onKeyDown: handleKeyPress,
|
|
762
796
|
onFocus: function onFocus() {
|
|
763
797
|
return setContainerHasFocus(true);
|
|
@@ -783,7 +817,8 @@ export var DataSpreadsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
|
783
817
|
updateActiveCellCoordinates: updateActiveCellCoordinates,
|
|
784
818
|
setHeaderCellHoldActive: setHeaderCellHoldActive,
|
|
785
819
|
headerCellHoldActive: headerCellHoldActive,
|
|
786
|
-
visibleColumns: visibleColumns
|
|
820
|
+
visibleColumns: visibleColumns,
|
|
821
|
+
selectAllAriaLabel: selectAllAriaLabel
|
|
787
822
|
}), /*#__PURE__*/React.createElement(DataSpreadsheetBody, {
|
|
788
823
|
activeCellCoordinates: activeCellCoordinates,
|
|
789
824
|
ref: spreadsheetRef,
|
|
@@ -818,6 +853,7 @@ export var DataSpreadsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
|
818
853
|
visibleColumns: visibleColumns
|
|
819
854
|
}), /*#__PURE__*/React.createElement("button", {
|
|
820
855
|
onMouseDown: handleActiveCellMouseDown,
|
|
856
|
+
onMouseUp: handleActiveCellMouseUp,
|
|
821
857
|
onClick: handleActiveCellClick,
|
|
822
858
|
onKeyDown: handleActiveCellKeyDown,
|
|
823
859
|
onDoubleClick: handleActiveCellDoubleClick,
|
|
@@ -826,6 +862,7 @@ export var DataSpreadsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
|
826
862
|
className: cx("".concat(blockClass, "--interactive-cell-element"), "".concat(blockClass, "__active-cell--highlight"), _defineProperty({}, "".concat(blockClass, "__active-cell--with-selection"), activeCellInsideSelectionArea)),
|
|
827
863
|
type: "button"
|
|
828
864
|
}, activeCellContent), /*#__PURE__*/React.createElement(TextArea, {
|
|
865
|
+
id: "".concat(blockClass, "__cell-editor-text-area"),
|
|
829
866
|
value: cellEditorValue,
|
|
830
867
|
onKeyDown: handleEditSubmit({
|
|
831
868
|
activeCellCoordinates: activeCellCoordinates,
|
|
@@ -846,7 +883,7 @@ export var DataSpreadsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
|
846
883
|
},
|
|
847
884
|
ref: cellEditorRef,
|
|
848
885
|
labelText: "",
|
|
849
|
-
"aria-labelledby": activeCellCoordinates ? "
|
|
886
|
+
"aria-labelledby": activeCellCoordinates ? "".concat(blockClass, "__cell--").concat(activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row, "--").concat(activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) : null,
|
|
850
887
|
className: cx("".concat(blockClass, "__cell-editor"), "".concat(blockClass, "--interactive-cell-element"), "".concat(blockClass, "__cell-editor--").concat(cellSize), _defineProperty({}, "".concat(blockClass, "__cell-editor--active"), isEditing))
|
|
851
888
|
}), /*#__PURE__*/React.createElement("pre", {
|
|
852
889
|
"aria-hidden": true,
|
|
@@ -913,6 +950,21 @@ DataSpreadsheet.propTypes = {
|
|
|
913
950
|
*/
|
|
914
951
|
onSelectionAreaChange: PropTypes.func,
|
|
915
952
|
|
|
953
|
+
/**
|
|
954
|
+
* The aria label applied to the Select all button
|
|
955
|
+
*/
|
|
956
|
+
selectAllAriaLabel: PropTypes.string.isRequired,
|
|
957
|
+
|
|
958
|
+
/**
|
|
959
|
+
* The aria label applied to the Data spreadsheet component
|
|
960
|
+
*/
|
|
961
|
+
spreadsheetAriaLabel: PropTypes.string.isRequired,
|
|
962
|
+
|
|
963
|
+
/**
|
|
964
|
+
* The theme the DataSpreadsheet should use (only used to render active cell/selection area colors on dark theme)
|
|
965
|
+
*/
|
|
966
|
+
theme: PropTypes.oneOf(['light', 'dark']),
|
|
967
|
+
|
|
916
968
|
/**
|
|
917
969
|
* The total number of columns to be initially visible, additional columns will be rendered and
|
|
918
970
|
* visible via horizontal scrollbar
|
|
@@ -385,7 +385,8 @@ export var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
385
385
|
}), {
|
|
386
386
|
className: cx("".concat(blockClass, "__tr")),
|
|
387
387
|
"data-row-index": index,
|
|
388
|
-
"aria-rowindex": index + 1
|
|
388
|
+
"aria-rowindex": index + 1,
|
|
389
|
+
"aria-owns": "".concat(blockClass, "__cell-editor-text-area")
|
|
389
390
|
}), /*#__PURE__*/React.createElement("div", {
|
|
390
391
|
role: "rowheader",
|
|
391
392
|
className: "".concat(blockClass, "__td-th--cell-container")
|
|
@@ -43,6 +43,7 @@ export var DataSpreadsheetHeader = /*#__PURE__*/forwardRef(function (_ref, ref)
|
|
|
43
43
|
updateActiveCellCoordinates = _ref.updateActiveCellCoordinates,
|
|
44
44
|
setHeaderCellHoldActive = _ref.setHeaderCellHoldActive,
|
|
45
45
|
headerCellHoldActive = _ref.headerCellHoldActive,
|
|
46
|
+
selectAllAriaLabel = _ref.selectAllAriaLabel,
|
|
46
47
|
visibleColumns = _ref.visibleColumns;
|
|
47
48
|
|
|
48
49
|
var _useState = useState(0),
|
|
@@ -175,6 +176,7 @@ export var DataSpreadsheetHeader = /*#__PURE__*/forwardRef(function (_ref, ref)
|
|
|
175
176
|
"data-column-index": "header",
|
|
176
177
|
type: "button",
|
|
177
178
|
tabIndex: -1,
|
|
179
|
+
"aria-label": selectAllAriaLabel,
|
|
178
180
|
onClick: handleSelectAllClick,
|
|
179
181
|
className: cx("".concat(blockClass, "__th"), "".concat(blockClass, "--interactive-cell-element"), "".concat(blockClass, "__th--select-all"), _defineProperty({}, "".concat(blockClass, "__th--active-header"), (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header' && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header'))
|
|
180
182
|
}, "\xA0")), headerGroup.headers.map(function (column, index) {
|
|
@@ -258,6 +260,11 @@ DataSpreadsheetHeader.propTypes = {
|
|
|
258
260
|
*/
|
|
259
261
|
scrollBarSize: PropTypes.number,
|
|
260
262
|
|
|
263
|
+
/**
|
|
264
|
+
* The aria label applied to the Select all button
|
|
265
|
+
*/
|
|
266
|
+
selectAllAriaLabel: PropTypes.string.isRequired,
|
|
267
|
+
|
|
261
268
|
/**
|
|
262
269
|
* All of the cell selection area items
|
|
263
270
|
*/
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2022, 2022
|
|
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 { deepCloneObject } from '../../../global/js/utils/deepCloneObject';
|
|
8
|
+
import { rangeWithCallback } from '../../../global/js/utils/rangeWithCallback';
|
|
9
|
+
export var handleCellDeletion = function handleCellDeletion(_ref) {
|
|
10
|
+
var selectionAreas = _ref.selectionAreas,
|
|
11
|
+
currentMatcher = _ref.currentMatcher,
|
|
12
|
+
rows = _ref.rows,
|
|
13
|
+
setActiveCellContent = _ref.setActiveCellContent,
|
|
14
|
+
updateData = _ref.updateData;
|
|
15
|
+
var selectionAreaClone = deepCloneObject(selectionAreas);
|
|
16
|
+
var indexOfCurrentSelectionArea = selectionAreaClone.findIndex(function (item) {
|
|
17
|
+
return item.matcher === currentMatcher;
|
|
18
|
+
});
|
|
19
|
+
var selectionAreaToEmptyContents = selectionAreaClone[indexOfCurrentSelectionArea];
|
|
20
|
+
var lowestColumnIndex = Math.min(selectionAreaToEmptyContents.point1.column, selectionAreaToEmptyContents.point2.column);
|
|
21
|
+
var greatestColumnIndex = Math.max(selectionAreaToEmptyContents.point1.column, selectionAreaToEmptyContents.point2.column);
|
|
22
|
+
var lowestRowIndex = Math.min(selectionAreaToEmptyContents.point1.row, selectionAreaToEmptyContents.point2.row);
|
|
23
|
+
var greatestRowIndex = Math.max(selectionAreaToEmptyContents.point1.row, selectionAreaToEmptyContents.point2.row);
|
|
24
|
+
rangeWithCallback(lowestColumnIndex, greatestColumnIndex, function (columnIndex) {
|
|
25
|
+
rangeWithCallback(lowestRowIndex, greatestRowIndex, function (rowIndex) {
|
|
26
|
+
var cellProps = rows[rowIndex].cells[columnIndex];
|
|
27
|
+
updateData(rowIndex, cellProps === null || cellProps === void 0 ? void 0 : cellProps.column.id, '');
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
setActiveCellContent(null);
|
|
31
|
+
};
|