@carbon/ibm-products 1.8.0 → 1.11.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 +270 -5656
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +6 -6
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +58 -3432
- 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 +238 -3922
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +6 -6
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +238 -3923
- package/css/index.css.map +1 -1
- package/css/index.min.css +6 -6
- package/css/index.min.css.map +1 -1
- package/es/components/AddSelect/AddSelect.js +147 -53
- package/es/components/AddSelect/AddSelectBreadcrumbs.js +4 -4
- package/es/components/AddSelect/AddSelectColumn.js +195 -0
- package/es/components/AddSelect/AddSelectList.js +67 -8
- package/es/components/AddSelect/AddSelectSidebar.js +8 -15
- package/es/components/AddSelect/add-select-utils.js +64 -0
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +2 -1
- package/es/components/ButtonMenu/ButtonMenu.js +1 -1
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +505 -167
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +244 -17
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +74 -8
- package/es/components/DataSpreadsheet/hooks/useMoveActiveCell.js +27 -0
- package/es/components/DataSpreadsheet/hooks/useResetSpreadsheetFocus.js +28 -0
- package/es/components/DataSpreadsheet/hooks/useSpreadsheetOutsideClick.js +41 -0
- package/es/components/DataSpreadsheet/utils/checkActiveHeaderCell.js +34 -0
- package/es/components/DataSpreadsheet/utils/createActiveCellFn.js +58 -0
- package/es/components/DataSpreadsheet/utils/createCellSelectionArea.js +49 -0
- package/es/components/DataSpreadsheet/{generateData.js → utils/generateData.js} +6 -0
- package/es/components/DataSpreadsheet/{getCellSize.js → utils/getCellSize.js} +0 -0
- package/es/components/DataSpreadsheet/utils/handleHeaderCellSelection.js +46 -0
- package/es/components/DataSpreadsheet/utils/handleMultipleKeys.js +82 -0
- package/es/components/DataSpreadsheet/utils/removeCellSelections.js +30 -0
- package/es/components/InlineEdit/InlineEdit.js +80 -39
- package/es/components/OptionsTile/OptionsTile.js +31 -21
- package/es/components/OptionsTile/index.js +1 -1
- package/es/components/PageHeader/PageHeader.js +26 -15
- package/es/components/PageHeader/PageHeaderTitle.js +2 -1
- package/es/components/PageHeader/PageHeaderUtils.js +24 -29
- package/es/components/TagSet/TagSet.js +12 -3
- package/es/components/UserProfileImage/UserProfileImage.js +2 -1
- package/es/global/js/utils/DisplayBox.js +31 -0
- package/es/global/js/utils/deepCloneObject.js +26 -0
- package/lib/components/AddSelect/AddSelect.js +150 -54
- package/lib/components/AddSelect/AddSelectBreadcrumbs.js +2 -3
- package/lib/components/AddSelect/AddSelectColumn.js +219 -0
- package/lib/components/AddSelect/AddSelectList.js +65 -8
- package/lib/components/AddSelect/AddSelectSidebar.js +14 -15
- package/lib/components/AddSelect/add-select-utils.js +78 -0
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +2 -1
- package/lib/components/ButtonMenu/ButtonMenu.js +1 -1
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +514 -170
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +251 -18
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +82 -9
- package/lib/components/DataSpreadsheet/hooks/useMoveActiveCell.js +37 -0
- package/lib/components/DataSpreadsheet/hooks/useResetSpreadsheetFocus.js +39 -0
- package/lib/components/DataSpreadsheet/hooks/useSpreadsheetOutsideClick.js +52 -0
- package/lib/components/DataSpreadsheet/utils/checkActiveHeaderCell.js +45 -0
- package/lib/components/DataSpreadsheet/{createActiveCellFn.js → utils/createActiveCellFn.js} +22 -9
- package/lib/components/DataSpreadsheet/utils/createCellSelectionArea.js +60 -0
- package/lib/components/DataSpreadsheet/{generateData.js → utils/generateData.js} +6 -0
- package/lib/components/DataSpreadsheet/{getCellSize.js → utils/getCellSize.js} +0 -0
- package/lib/components/DataSpreadsheet/utils/handleHeaderCellSelection.js +59 -0
- package/lib/components/DataSpreadsheet/utils/handleMultipleKeys.js +92 -0
- package/lib/components/DataSpreadsheet/utils/removeCellSelections.js +41 -0
- package/lib/components/InlineEdit/InlineEdit.js +82 -40
- package/lib/components/OptionsTile/OptionsTile.js +30 -20
- package/lib/components/PageHeader/PageHeader.js +25 -15
- package/lib/components/PageHeader/PageHeaderTitle.js +2 -1
- package/lib/components/PageHeader/PageHeaderUtils.js +24 -29
- package/lib/components/TagSet/TagSet.js +13 -3
- package/lib/components/UserProfileImage/UserProfileImage.js +2 -1
- package/lib/global/js/utils/DisplayBox.js +46 -0
- package/lib/global/js/utils/deepCloneObject.js +37 -0
- package/package.json +17 -17
- package/scss/components/ActionBar/_storybook-styles.scss +8 -0
- package/scss/components/ActionSet/_storybook-styles.scss +1 -3
- package/scss/components/AddSelect/_add-select.scss +99 -14
- package/scss/components/BreadcrumbWithOverflow/_breadcrumb-with-overflow.scss +7 -3
- package/scss/components/BreadcrumbWithOverflow/_storybook-styles.scss +8 -0
- package/scss/components/ButtonSetWithOverflow/_storybook-styles.scss +8 -0
- package/scss/components/CreateInfluencer/_create-influencer.scss +2 -0
- package/scss/components/CreateModal/_create-modal.scss +1 -0
- package/scss/components/CreateSidePanel/_create-side-panel.scss +1 -1
- package/scss/components/CreateSidePanel/_storybook-styles.scss +1 -1
- package/scss/components/CreateTearsheet/_create-tearsheet.scss +1 -0
- package/scss/components/CreateTearsheetNarrow/_create-tearsheet-narrow.scss +1 -0
- package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +42 -6
- package/scss/components/EditSidePanel/_edit-side-panel.scss +9 -0
- package/scss/components/EditSidePanel/_storybook-styles.scss +1 -1
- package/scss/components/InlineEdit/_inline-edit.scss +53 -43
- package/scss/components/InlineEdit/_storybook-styles.scss +2 -0
- package/scss/components/LoadingBar/_loading-bar.scss +13 -0
- package/scss/components/NotificationsPanel/_notifications-panel.scss +3 -0
- package/scss/components/OptionsTile/_index.scss +1 -1
- package/scss/components/OptionsTile/_options-tile.scss +17 -17
- package/scss/components/OptionsTile/_storybook-styles.scss +4 -4
- package/scss/components/PageHeader/_page-header.scss +5 -2
- package/scss/components/SidePanel/_side-panel.scss +19 -12
- package/scss/components/StatusIcon/_status-icon.scss +1 -0
- package/scss/components/TagSet/_storybook-styles.scss +8 -0
- package/scss/components/Tearsheet/_tearsheet.scss +1 -2
- package/scss/components/UserProfileImage/_user-profile-image.scss +9 -0
- package/scss/components/WebTerminal/_web-terminal.scss +2 -0
- package/scss/global/styles/_display-box.scss +62 -0
- package/es/components/DataSpreadsheet/createActiveCellFn.js +0 -45
package/lib/components/DataSpreadsheet/{createActiveCellFn.js → utils/createActiveCellFn.js}
RENAMED
|
@@ -7,7 +7,7 @@ exports.createActiveCellFn = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _layout = require("@carbon/layout");
|
|
9
9
|
|
|
10
|
-
var _settings = require("
|
|
10
|
+
var _settings = require("../../../settings");
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Copyright IBM Corp. 2022, 2022
|
|
@@ -24,7 +24,10 @@ var createActiveCellFn = function createActiveCellFn(_ref) {
|
|
|
24
24
|
_ref$blockClass = _ref.blockClass,
|
|
25
25
|
blockClass = _ref$blockClass === void 0 ? "".concat(_settings.pkg.prefix, "--data-spreadsheet") : _ref$blockClass,
|
|
26
26
|
onActiveCellChange = _ref.onActiveCellChange,
|
|
27
|
-
activeCellValue = _ref.activeCellValue
|
|
27
|
+
activeCellValue = _ref.activeCellValue,
|
|
28
|
+
activeCellRef = _ref.activeCellRef,
|
|
29
|
+
cellEditorRef = _ref.cellEditorRef,
|
|
30
|
+
defaultColumn = _ref.defaultColumn;
|
|
28
31
|
|
|
29
32
|
if (!coords) {
|
|
30
33
|
return;
|
|
@@ -32,24 +35,34 @@ var createActiveCellFn = function createActiveCellFn(_ref) {
|
|
|
32
35
|
// to `.${blockClass}__header--container`, otherwise it should be appended to `.${blockClass}__listContainer` firstElementChild
|
|
33
36
|
|
|
34
37
|
|
|
38
|
+
var point1Element = document.querySelector("[data-row-index=\"".concat(coords.row, "\"][data-column-index=\"").concat(coords.column, "\"]")) || document.querySelector(".".concat(blockClass, "__body--td")); // if we can't find the point1 element (this can happen in the case where a virtualized row is not present anymore in the DOM), we get the default height/width of the first body cell we find
|
|
39
|
+
|
|
40
|
+
var selectionAreaCellWidth = point1Element.offsetWidth;
|
|
41
|
+
var selectionAreaCellHeight = point1Element.offsetHeight;
|
|
35
42
|
var activeElementContainer = addToHeader ? contextRef === null || contextRef === void 0 ? void 0 : contextRef.current.querySelector(".".concat(blockClass, "__header--container")) : contextRef === null || contextRef === void 0 ? void 0 : contextRef.current.querySelector(".".concat(blockClass, "__list--container")).firstElementChild;
|
|
36
43
|
var relativePosition = {
|
|
37
|
-
top: placementElement.getBoundingClientRect().top - activeElementContainer.getBoundingClientRect().top,
|
|
38
|
-
|
|
44
|
+
top: placementElement ? placementElement.getBoundingClientRect().top - activeElementContainer.getBoundingClientRect().top : coords.row === 0 ? 0 : selectionAreaCellHeight * coords.row,
|
|
45
|
+
// calculate top value here if virtualized row is not in DOM
|
|
46
|
+
left: placementElement ? placementElement.getBoundingClientRect().left - activeElementContainer.getBoundingClientRect().left : coords.column === 0 ? 0 + (defaultColumn.rowHeaderWidth - 4) : selectionAreaCellWidth * coords.column + (defaultColumn.rowHeaderWidth - 4) // calculate left value here if virtualized row is not in DOM, accounting for row header cell width (including borders)
|
|
47
|
+
|
|
39
48
|
};
|
|
40
|
-
var activeCellButton =
|
|
41
|
-
activeCellButton.
|
|
42
|
-
activeCellButton.style.
|
|
43
|
-
activeCellButton.style.height = (0, _layout.px)(placementElement === null || placementElement === void 0 ? void 0 : placementElement.offsetHeight);
|
|
49
|
+
var activeCellButton = activeCellRef === null || activeCellRef === void 0 ? void 0 : activeCellRef.current;
|
|
50
|
+
activeCellButton.style.width = (0, _layout.px)(placementElement ? placementElement === null || placementElement === void 0 ? void 0 : placementElement.offsetWidth : selectionAreaCellWidth);
|
|
51
|
+
activeCellButton.style.height = (0, _layout.px)(placementElement ? placementElement === null || placementElement === void 0 ? void 0 : placementElement.offsetHeight : selectionAreaCellHeight);
|
|
44
52
|
activeCellButton.style.left = (0, _layout.px)(relativePosition.left);
|
|
45
53
|
activeCellButton.style.top = (0, _layout.px)(relativePosition.top);
|
|
54
|
+
activeCellButton.style.display = 'block';
|
|
46
55
|
activeCellButton.setAttribute('data-active-row-index', typeof (coords === null || coords === void 0 ? void 0 : coords.row) === 'number' ? coords.row : 'header');
|
|
47
56
|
activeCellButton.setAttribute('data-active-column-index', typeof (coords === null || coords === void 0 ? void 0 : coords.column) === 'number' ? coords.column : 'header');
|
|
48
57
|
activeElementContainer.appendChild(activeCellButton);
|
|
49
58
|
activeCellButton.focus();
|
|
50
59
|
|
|
60
|
+
if (!addToHeader) {
|
|
61
|
+
activeElementContainer.appendChild(cellEditorRef.current);
|
|
62
|
+
}
|
|
63
|
+
|
|
51
64
|
if (typeof (coords === null || coords === void 0 ? void 0 : coords.column) === 'number' && typeof (coords === null || coords === void 0 ? void 0 : coords.row) === 'number') {
|
|
52
|
-
onActiveCellChange(activeCellValue);
|
|
65
|
+
onActiveCellChange === null || onActiveCellChange === void 0 ? void 0 : onActiveCellChange(activeCellValue);
|
|
53
66
|
}
|
|
54
67
|
};
|
|
55
68
|
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createCellSelectionArea = void 0;
|
|
7
|
+
|
|
8
|
+
var _layout = require("@carbon/layout");
|
|
9
|
+
|
|
10
|
+
var _deepCloneObject = require("../../../global/js/utils/deepCloneObject");
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Copyright IBM Corp. 2022, 2022
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/
|
|
18
|
+
var createCellSelectionArea = function createCellSelectionArea(_ref) {
|
|
19
|
+
var area = _ref.area,
|
|
20
|
+
blockClass = _ref.blockClass,
|
|
21
|
+
defaultColumn = _ref.defaultColumn,
|
|
22
|
+
selectionAreas = _ref.selectionAreas,
|
|
23
|
+
setSelectionAreas = _ref.setSelectionAreas;
|
|
24
|
+
var greatestRow = Math.max(area.point1.row, area.point2.row);
|
|
25
|
+
var greatestColumn = Math.max(area.point1.column, area.point2.column);
|
|
26
|
+
var lowestRowIndex = Math.min(area.point1.row, area.point2.row);
|
|
27
|
+
var lowestColumnIndex = Math.min(area.point1.column, area.point2.column);
|
|
28
|
+
var point1Element = document.querySelector("[data-row-index=\"".concat(area.point1.row, "\"][data-column-index=\"").concat(area.point1.column, "\"]")) || document.querySelector(".".concat(blockClass, "__body--td")); // if we can't find the point1 element (this can happen in the case where a virtualized row is not present anymore in the DOM), we get the default height/width of the first body cell we find
|
|
29
|
+
|
|
30
|
+
var selectionAreaCellWidth = point1Element.offsetWidth;
|
|
31
|
+
var selectionAreaCellHeight = point1Element.offsetHeight;
|
|
32
|
+
var selectionAreaTotalWidth = selectionAreaCellWidth * (greatestColumn - lowestColumnIndex + 1);
|
|
33
|
+
var selectionAreaTotalHeight = selectionAreaCellHeight * (greatestRow - lowestRowIndex + 1);
|
|
34
|
+
var bodyContainer = document.querySelector(".".concat(blockClass, "__list--container")).firstElementChild;
|
|
35
|
+
var placementElement = bodyContainer.querySelector("[data-row-index=\"".concat(lowestRowIndex, "\"][data-column-index=\"").concat(lowestColumnIndex, "\"]"));
|
|
36
|
+
var relativePosition = {
|
|
37
|
+
top: placementElement ? placementElement.getBoundingClientRect().top - bodyContainer.getBoundingClientRect().top : lowestRowIndex === 0 ? 0 : selectionAreaCellHeight * lowestRowIndex,
|
|
38
|
+
// calculate top value here if virtualized row is not in DOM
|
|
39
|
+
left: placementElement ? placementElement.getBoundingClientRect().left - bodyContainer.getBoundingClientRect().left : lowestColumnIndex === 0 ? 0 + (defaultColumn.rowHeaderWidth - 4) : selectionAreaCellWidth * lowestColumnIndex + (defaultColumn.rowHeaderWidth - 4) // calculate left value here if virtualized row is not in DOM, accounting for row header cell width (including borders)
|
|
40
|
+
|
|
41
|
+
};
|
|
42
|
+
var selectionAreaElement = document.querySelector("[data-matcher-id=\"".concat(area.matcher, "\"]")) || document.createElement('div');
|
|
43
|
+
selectionAreaElement.classList.add("".concat(blockClass, "__selection-area--element"));
|
|
44
|
+
selectionAreaElement.setAttribute('data-matcher-id', area.matcher);
|
|
45
|
+
selectionAreaElement.style.width = (0, _layout.px)(selectionAreaTotalWidth);
|
|
46
|
+
selectionAreaElement.style.height = (0, _layout.px)(selectionAreaTotalHeight);
|
|
47
|
+
selectionAreaElement.style.left = (0, _layout.px)(relativePosition.left);
|
|
48
|
+
selectionAreaElement.style.top = (0, _layout.px)(relativePosition.top);
|
|
49
|
+
bodyContainer.appendChild(selectionAreaElement);
|
|
50
|
+
var selectionAreasClone = (0, _deepCloneObject.deepCloneObject)(selectionAreas);
|
|
51
|
+
var indexOfCurrentArea = selectionAreasClone.findIndex(function (item) {
|
|
52
|
+
return item.matcher === area.matcher;
|
|
53
|
+
}); // We need to add another property to the selectionAreas object array to
|
|
54
|
+
// let us know if an area has been created for each item already, ie createdArea: true
|
|
55
|
+
|
|
56
|
+
selectionAreasClone[indexOfCurrentArea].areaCreated = true;
|
|
57
|
+
setSelectionAreas(selectionAreasClone);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
exports.createCellSelectionArea = createCellSelectionArea;
|
|
@@ -13,6 +13,12 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
13
13
|
|
|
14
14
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Copyright IBM Corp. 2022, 2022
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
20
|
+
* LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/
|
|
16
22
|
// cspell:disable
|
|
17
23
|
var pets = ['dog', 'cat', 'bird', 'lizard', 'frog', 'hamster', 'fish', 'rabbit', 'snake'];
|
|
18
24
|
var petNames = ['Bruno', 'Willow', 'Kona', 'Heidi', 'Rusty', 'Bonnie', 'Cash', 'Gucci', 'Brody', 'Emma', 'Loki', 'Angel', 'Astro', 'Sherman', 'Layla', 'Peanut', 'Grace', 'Mickey', 'Sasha', 'Finn', 'Tucker', 'Bear', 'Mocha', 'Roscoe']; // cspell:enable
|
|
File without changes
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.handleHeaderCellSelection = void 0;
|
|
9
|
+
|
|
10
|
+
var _uuidv = _interopRequireDefault(require("../../../global/js/utils/uuidv4"));
|
|
11
|
+
|
|
12
|
+
var _removeCellSelections = require("./removeCellSelections");
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Copyright IBM Corp. 2022, 2022
|
|
16
|
+
*
|
|
17
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
18
|
+
* LICENSE file in the root directory of this source tree.
|
|
19
|
+
*/
|
|
20
|
+
var handleHeaderCellSelection = function handleHeaderCellSelection(_ref) {
|
|
21
|
+
var type = _ref.type,
|
|
22
|
+
activeCellCoordinates = _ref.activeCellCoordinates,
|
|
23
|
+
rows = _ref.rows,
|
|
24
|
+
columns = _ref.columns,
|
|
25
|
+
setActiveCellCoordinates = _ref.setActiveCellCoordinates,
|
|
26
|
+
setCurrentMatcher = _ref.setCurrentMatcher,
|
|
27
|
+
setSelectionAreas = _ref.setSelectionAreas,
|
|
28
|
+
spreadsheetRef = _ref.spreadsheetRef,
|
|
29
|
+
index = _ref.index,
|
|
30
|
+
isKeyboard = _ref.isKeyboard;
|
|
31
|
+
var rowValue = isKeyboard ? activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row : index;
|
|
32
|
+
var columnValue = isKeyboard ? activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column : index;
|
|
33
|
+
var point1 = {
|
|
34
|
+
row: type === 'column' ? 0 : rowValue,
|
|
35
|
+
column: type === 'column' ? columnValue : 0
|
|
36
|
+
};
|
|
37
|
+
var point2 = {
|
|
38
|
+
row: type === 'column' ? rows.length - 1 : rowValue,
|
|
39
|
+
// going to always be the last row
|
|
40
|
+
column: type === 'column' ? columnValue : columns.length - 1
|
|
41
|
+
};
|
|
42
|
+
var tempMatcher = (0, _uuidv.default)();
|
|
43
|
+
setActiveCellCoordinates({
|
|
44
|
+
row: type === 'column' ? 0 : rowValue,
|
|
45
|
+
column: type === 'column' ? columnValue : 0
|
|
46
|
+
});
|
|
47
|
+
setCurrentMatcher(tempMatcher);
|
|
48
|
+
(0, _removeCellSelections.removeCellSelections)({
|
|
49
|
+
spreadsheetRef: spreadsheetRef
|
|
50
|
+
});
|
|
51
|
+
setSelectionAreas([{
|
|
52
|
+
point1: point1,
|
|
53
|
+
point2: point2,
|
|
54
|
+
areaCreated: false,
|
|
55
|
+
matcher: tempMatcher
|
|
56
|
+
}]);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
exports.handleHeaderCellSelection = handleHeaderCellSelection;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.handleMultipleKeys = void 0;
|
|
7
|
+
|
|
8
|
+
var _deepCloneObject = require("../../../global/js/utils/deepCloneObject");
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Copyright IBM Corp. 2022, 2022
|
|
12
|
+
*
|
|
13
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
14
|
+
* LICENSE file in the root directory of this source tree.
|
|
15
|
+
*/
|
|
16
|
+
var handleMultipleKeys = function handleMultipleKeys(_ref) {
|
|
17
|
+
var _selectionAreasClone$;
|
|
18
|
+
|
|
19
|
+
var activeKeys = _ref.activeKeys,
|
|
20
|
+
selectionAreas = _ref.selectionAreas,
|
|
21
|
+
currentMatcher = _ref.currentMatcher,
|
|
22
|
+
rows = _ref.rows,
|
|
23
|
+
setSelectionAreas = _ref.setSelectionAreas,
|
|
24
|
+
columns = _ref.columns;
|
|
25
|
+
var activeKeyValues = activeKeys.current;
|
|
26
|
+
var selectionAreasClone = (0, _deepCloneObject.deepCloneObject)(selectionAreas);
|
|
27
|
+
var indexOfCurrentArea = selectionAreasClone.findIndex(function (item) {
|
|
28
|
+
return item.matcher === currentMatcher;
|
|
29
|
+
});
|
|
30
|
+
var pointToUpdate = (_selectionAreasClone$ = selectionAreasClone[indexOfCurrentArea]) !== null && _selectionAreasClone$ !== void 0 && _selectionAreasClone$.point2 ? selectionAreasClone[indexOfCurrentArea].point2 : selectionAreasClone[indexOfCurrentArea].point1; // Down + Shift
|
|
31
|
+
|
|
32
|
+
if (activeKeyValues.includes('Shift') && activeKeyValues.includes('ArrowDown')) {
|
|
33
|
+
if (rows.length - 1 === pointToUpdate.row) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
var newPoint = {
|
|
38
|
+
row: pointToUpdate.row + 1,
|
|
39
|
+
column: pointToUpdate.column
|
|
40
|
+
};
|
|
41
|
+
selectionAreasClone[indexOfCurrentArea].point2 = newPoint;
|
|
42
|
+
selectionAreasClone[indexOfCurrentArea].areaCreated = false;
|
|
43
|
+
setSelectionAreas(selectionAreasClone);
|
|
44
|
+
} // Right + Shift
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
if (activeKeyValues.includes('Shift') && activeKeyValues.includes('ArrowRight')) {
|
|
48
|
+
if (columns.length - 1 === pointToUpdate.column) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
var _newPoint = {
|
|
53
|
+
row: pointToUpdate.row,
|
|
54
|
+
column: pointToUpdate.column + 1
|
|
55
|
+
};
|
|
56
|
+
selectionAreasClone[indexOfCurrentArea].point2 = _newPoint;
|
|
57
|
+
selectionAreasClone[indexOfCurrentArea].areaCreated = false;
|
|
58
|
+
setSelectionAreas(selectionAreasClone);
|
|
59
|
+
} // Up + Shift
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
if (activeKeyValues.includes('Shift') && activeKeyValues.includes('ArrowUp')) {
|
|
63
|
+
if (pointToUpdate.row === 0) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
var _newPoint2 = {
|
|
68
|
+
row: pointToUpdate.row - 1,
|
|
69
|
+
column: pointToUpdate.column
|
|
70
|
+
};
|
|
71
|
+
selectionAreasClone[indexOfCurrentArea].point2 = _newPoint2;
|
|
72
|
+
selectionAreasClone[indexOfCurrentArea].areaCreated = false;
|
|
73
|
+
setSelectionAreas(selectionAreasClone);
|
|
74
|
+
} // Left + Shift
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
if (activeKeyValues.includes('Shift') && activeKeyValues.includes('ArrowLeft')) {
|
|
78
|
+
if (pointToUpdate.column === 0) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
var _newPoint3 = {
|
|
83
|
+
row: pointToUpdate.row,
|
|
84
|
+
column: pointToUpdate.column - 1
|
|
85
|
+
};
|
|
86
|
+
selectionAreasClone[indexOfCurrentArea].point2 = _newPoint3;
|
|
87
|
+
selectionAreasClone[indexOfCurrentArea].areaCreated = false;
|
|
88
|
+
setSelectionAreas(selectionAreasClone);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
exports.handleMultipleKeys = handleMultipleKeys;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.removeCellSelections = void 0;
|
|
9
|
+
|
|
10
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
+
|
|
12
|
+
var _settings = require("../../../settings");
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Copyright IBM Corp. 2022, 2022
|
|
16
|
+
*
|
|
17
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
18
|
+
* LICENSE file in the root directory of this source tree.
|
|
19
|
+
*/
|
|
20
|
+
// Removes the cell selection elements
|
|
21
|
+
var removeCellSelections = function removeCellSelections(_ref) {
|
|
22
|
+
var matcher = _ref.matcher,
|
|
23
|
+
spreadsheetRef = _ref.spreadsheetRef,
|
|
24
|
+
_ref$blockClass = _ref.blockClass,
|
|
25
|
+
blockClass = _ref$blockClass === void 0 ? "".concat(_settings.pkg.prefix, "--data-spreadsheet") : _ref$blockClass;
|
|
26
|
+
|
|
27
|
+
if (matcher && typeof matcher === 'string') {
|
|
28
|
+
var selectionToRemove = spreadsheetRef.current.querySelector("[data-matcher-id=\"".concat(matcher, "\"]"));
|
|
29
|
+
|
|
30
|
+
if (selectionToRemove) {
|
|
31
|
+
selectionToRemove.remove();
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
var cellSelections = spreadsheetRef.current.querySelectorAll(".".concat(blockClass, "__selection-area--element"));
|
|
35
|
+
(0, _toConsumableArray2.default)(cellSelections).forEach(function (element) {
|
|
36
|
+
return element.remove();
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
exports.removeCellSelections = removeCellSelections;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
@@ -13,6 +13,8 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
13
13
|
|
|
14
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
15
|
|
|
16
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
17
|
+
|
|
16
18
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
17
19
|
|
|
18
20
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
@@ -31,21 +33,24 @@ var _carbonComponentsReact = require("carbon-components-react");
|
|
|
31
33
|
|
|
32
34
|
var _iconsReact = require("@carbon/icons-react");
|
|
33
35
|
|
|
34
|
-
var _excluded = ["cancelDescription", "className", "disabled", "
|
|
36
|
+
var _excluded = ["buttonTooltipAlignment", "buttonTooltipPosition", "cancelDescription", "className", "disabled", "editAlwaysVisible", "editDescription", "id", "invalid", "invalidText", "labelText", "light", "onCancel", "onSave", "onChange", "placeholder", "saveDescription", "size", "value"];
|
|
35
37
|
|
|
36
38
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
37
39
|
|
|
38
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null ||
|
|
40
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
39
41
|
|
|
40
42
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
|
41
43
|
var blockClass = "".concat(_settings.pkg.prefix, "--inline-edit");
|
|
42
44
|
var componentName = 'InlineEdit'; // NOTE: the component SCSS is not imported here: it is rolled up separately.
|
|
43
45
|
|
|
44
46
|
var defaults = {
|
|
47
|
+
buttonTooltipAlignment: 'center',
|
|
48
|
+
buttonTooltipPosition: 'top',
|
|
45
49
|
light: true,
|
|
46
50
|
// defaults to true to reflect design
|
|
47
51
|
size: 'md'
|
|
48
52
|
};
|
|
53
|
+
var buttons = ['cancel', 'edit', 'save'];
|
|
49
54
|
/**
|
|
50
55
|
* TODO: A description of the component.
|
|
51
56
|
*/
|
|
@@ -53,11 +58,13 @@ var defaults = {
|
|
|
53
58
|
var InlineEdit = /*#__PURE__*/_react.default.forwardRef(function (_ref, refIn) {
|
|
54
59
|
var _cx, _refInput$current, _refInput$current$inn, _cx3;
|
|
55
60
|
|
|
56
|
-
var
|
|
61
|
+
var buttonTooltipAlignment = _ref.buttonTooltipAlignment,
|
|
62
|
+
buttonTooltipPosition = _ref.buttonTooltipPosition,
|
|
63
|
+
cancelDescription = _ref.cancelDescription,
|
|
57
64
|
className = _ref.className,
|
|
58
65
|
disabled = _ref.disabled,
|
|
66
|
+
editAlwaysVisible = _ref.editAlwaysVisible,
|
|
59
67
|
editDescription = _ref.editDescription,
|
|
60
|
-
editVisibleOnHoverOnly = _ref.editVisibleOnHoverOnly,
|
|
61
68
|
id = _ref.id,
|
|
62
69
|
invalid = _ref.invalid,
|
|
63
70
|
invalidText = _ref.invalidText,
|
|
@@ -72,8 +79,6 @@ var InlineEdit = /*#__PURE__*/_react.default.forwardRef(function (_ref, refIn) {
|
|
|
72
79
|
_ref$size = _ref.size,
|
|
73
80
|
size = _ref$size === void 0 ? defaults.size : _ref$size,
|
|
74
81
|
value = _ref.value,
|
|
75
|
-
warn = _ref.warn,
|
|
76
|
-
warnText = _ref.warnText,
|
|
77
82
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
78
83
|
var refInput = (0, _react.useRef)(null);
|
|
79
84
|
var localRef = (0, _react.useRef)(null);
|
|
@@ -89,9 +94,25 @@ var InlineEdit = /*#__PURE__*/_react.default.forwardRef(function (_ref, refIn) {
|
|
|
89
94
|
internalValue = _useState4[0],
|
|
90
95
|
setInternalValue = _useState4[1];
|
|
91
96
|
|
|
92
|
-
var showValidation = invalid || warn;
|
|
93
|
-
|
|
94
|
-
var
|
|
97
|
+
var showValidation = invalid; // || warn;
|
|
98
|
+
|
|
99
|
+
var validationText = invalidText; // || warnText;
|
|
100
|
+
|
|
101
|
+
var validationIcon = showValidation ? /*#__PURE__*/_react.default.createElement(_iconsReact.WarningFilled16, null) : null; // sanitize the tooltip values
|
|
102
|
+
|
|
103
|
+
var alignIsObject = (0, _typeof2.default)(buttonTooltipAlignment) === 'object';
|
|
104
|
+
var directionIsObject = (0, _typeof2.default)(buttonTooltipPosition) === 'object';
|
|
105
|
+
var tipPositions = buttons.reduce(function (acc, button) {
|
|
106
|
+
var _ref2, _ref3;
|
|
107
|
+
|
|
108
|
+
var tooltipAlignment = (_ref2 = alignIsObject ? buttonTooltipAlignment[button] : buttonTooltipAlignment) !== null && _ref2 !== void 0 ? _ref2 : defaults.buttonTooltipAlignment;
|
|
109
|
+
var tooltipPosition = (_ref3 = directionIsObject ? buttonTooltipPosition[button] : buttonTooltipPosition) !== null && _ref3 !== void 0 ? _ref3 : defaults.buttonTooltipPosition;
|
|
110
|
+
acc[button] = {
|
|
111
|
+
tooltipAlignment: tooltipAlignment,
|
|
112
|
+
tooltipPosition: tooltipPosition
|
|
113
|
+
};
|
|
114
|
+
return acc;
|
|
115
|
+
}, {});
|
|
95
116
|
|
|
96
117
|
var doSetEditing = function doSetEditing(value) {
|
|
97
118
|
if (value === false) {
|
|
@@ -103,6 +124,7 @@ var InlineEdit = /*#__PURE__*/_react.default.forwardRef(function (_ref, refIn) {
|
|
|
103
124
|
};
|
|
104
125
|
|
|
105
126
|
var handleEdit = function handleEdit(ev) {
|
|
127
|
+
/* istanbul ignore else */
|
|
106
128
|
if (!disabled) {
|
|
107
129
|
var rightOfInput = ev.currentTarget.classList.contains("".concat(blockClass, "__edit")) || ev.target.classList.contains("".concat(blockClass, "__after-input-elements"));
|
|
108
130
|
var leftOfInput = ev.currentTarget = ev.target.classList.contains("".concat(blockClass)); // clicking on the content editable element should not set either of these to true
|
|
@@ -149,9 +171,12 @@ var InlineEdit = /*#__PURE__*/_react.default.forwardRef(function (_ref, refIn) {
|
|
|
149
171
|
if (onChange) {
|
|
150
172
|
onChange(refInput.current.innerText);
|
|
151
173
|
}
|
|
152
|
-
};
|
|
174
|
+
}; // pasting into contentEditable not supported by userEvent
|
|
175
|
+
|
|
153
176
|
|
|
154
|
-
var handlePaste =
|
|
177
|
+
var handlePaste =
|
|
178
|
+
/* istanbul ignore next */
|
|
179
|
+
function handlePaste(ev) {
|
|
155
180
|
ev.preventDefault(); // Get clipboard as plain text
|
|
156
181
|
|
|
157
182
|
var text = (ev.clipboardData || window.clipboardData).getData('text/plain'); // remove \n
|
|
@@ -196,9 +221,16 @@ var InlineEdit = /*#__PURE__*/_react.default.forwardRef(function (_ref, refIn) {
|
|
|
196
221
|
};
|
|
197
222
|
|
|
198
223
|
var handleKeyDown = function handleKeyDown(ev) {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
224
|
+
switch (ev.key) {
|
|
225
|
+
case 'Enter':
|
|
226
|
+
ev.preventDefault();
|
|
227
|
+
refInput.current.blur(); // will cause save
|
|
228
|
+
|
|
229
|
+
break;
|
|
230
|
+
|
|
231
|
+
case 'Escape':
|
|
232
|
+
handleCancel();
|
|
233
|
+
break;
|
|
202
234
|
}
|
|
203
235
|
};
|
|
204
236
|
/*
|
|
@@ -232,7 +264,7 @@ var InlineEdit = /*#__PURE__*/_react.default.forwardRef(function (_ref, refIn) {
|
|
|
232
264
|
_react.default.createElement("div", {
|
|
233
265
|
className: (0, _classnames.default)(blockClass, // Apply the block class to the main HTML element
|
|
234
266
|
className, // Apply any supplied class names to the main HTML element.
|
|
235
|
-
"".concat(blockClass, "--").concat(size), (_cx = {}, (0, _defineProperty2.default)(_cx, "".concat(blockClass, "--disabled"), disabled), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "--editing"), editing), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "--invalid"), invalid), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "--
|
|
267
|
+
"".concat(blockClass, "--").concat(size), (_cx = {}, (0, _defineProperty2.default)(_cx, "".concat(blockClass, "--disabled"), disabled), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "--editing"), editing), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "--invalid"), invalid), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "--light"), light), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "--overflows"), refInput.current && refInput.current.scrollWidth > refInput.current.offsetWidth), _cx)),
|
|
236
268
|
onClick: handleEdit // disabled eslint for click handler
|
|
237
269
|
,
|
|
238
270
|
onBlur: handleBlur,
|
|
@@ -263,14 +295,14 @@ var InlineEdit = /*#__PURE__*/_react.default.forwardRef(function (_ref, refIn) {
|
|
|
263
295
|
className: (0, _classnames.default)("".concat(blockClass, "__toolbar"), (_cx3 = {}, (0, _defineProperty2.default)(_cx3, "".concat(blockClass, "__toolbar--animation"), toolbarAnimation), (0, _defineProperty2.default)(_cx3, "".concat(blockClass, "__toolbar--saveable"), refInput.current && value !== internalValue), _cx3))
|
|
264
296
|
}, showValidation && /*#__PURE__*/_react.default.createElement("div", {
|
|
265
297
|
className: "".concat(blockClass, "__validation-icon")
|
|
266
|
-
}, validationIcon), editing ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
|
298
|
+
}, validationIcon), editing ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, (0, _extends2.default)({
|
|
267
299
|
className: "".concat(blockClass, "__cancel"),
|
|
268
300
|
kind: "ghost",
|
|
269
301
|
hasIconOnly: true,
|
|
270
302
|
iconDescription: cancelDescription,
|
|
271
303
|
onClick: handleCancel,
|
|
272
304
|
renderIcon: _iconsReact.Close16
|
|
273
|
-
}), /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
|
305
|
+
}, tipPositions.cancel)), /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, (0, _extends2.default)({
|
|
274
306
|
className: "".concat(blockClass, "__save"),
|
|
275
307
|
kind: "ghost",
|
|
276
308
|
hasIconOnly: true,
|
|
@@ -278,9 +310,8 @@ var InlineEdit = /*#__PURE__*/_react.default.forwardRef(function (_ref, refIn) {
|
|
|
278
310
|
onClick: handleSave,
|
|
279
311
|
renderIcon: _iconsReact.Checkmark16,
|
|
280
312
|
disabled: value === internalValue
|
|
281
|
-
})) : /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
|
282
|
-
"
|
|
283
|
-
className: (0, _classnames.default)("".concat(blockClass, "__edit"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__edit--hover-visible"), editVisibleOnHoverOnly)),
|
|
313
|
+
}, tipPositions.save))) : /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, (0, _extends2.default)({
|
|
314
|
+
className: (0, _classnames.default)("".concat(blockClass, "__edit"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__edit--always-visible"), editAlwaysVisible)),
|
|
284
315
|
kind: "ghost",
|
|
285
316
|
hasIconOnly: true,
|
|
286
317
|
iconDescription: editDescription,
|
|
@@ -288,7 +319,7 @@ var InlineEdit = /*#__PURE__*/_react.default.forwardRef(function (_ref, refIn) {
|
|
|
288
319
|
renderIcon: disabled ? _iconsReact.EditOff16 : _iconsReact.Edit16,
|
|
289
320
|
disabled: disabled,
|
|
290
321
|
tabIndex: -1
|
|
291
|
-
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
322
|
+
}, tipPositions.edit)))), /*#__PURE__*/_react.default.createElement("div", {
|
|
292
323
|
className: (0, _classnames.default)("".concat(blockClass, "__disabled-cover"))
|
|
293
324
|
}), showValidation && validationText && validationText.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
|
|
294
325
|
className: "".concat(blockClass, "__validation-text ").concat(_settings.carbon.prefix, "--form-requirement")
|
|
@@ -306,6 +337,28 @@ InlineEdit.displayName = componentName; // The types and DocGen commentary for t
|
|
|
306
337
|
// See https://www.npmjs.com/package/prop-types#usage.
|
|
307
338
|
|
|
308
339
|
InlineEdit.propTypes = {
|
|
340
|
+
/**
|
|
341
|
+
* buttonTooltipAlignment from the standard tooltip. Default center.
|
|
342
|
+
*
|
|
343
|
+
* Can be passed either as one of tooltip options or as an object specifying cancel, edit and save separately
|
|
344
|
+
*/
|
|
345
|
+
buttonTooltipAlignment: _propTypes.default.oneOfType([_propTypes.default.oneOf(['start', 'center', 'end']), _propTypes.default.shape({
|
|
346
|
+
cancel: _propTypes.default.oneOf(['start', 'center', 'end']),
|
|
347
|
+
edit: _propTypes.default.oneOf(['start', 'center', 'end']),
|
|
348
|
+
save: _propTypes.default.oneOf(['start', 'center', 'end'])
|
|
349
|
+
})]),
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* buttonTooltipPosition from the standard tooltip
|
|
353
|
+
*
|
|
354
|
+
* Can be passed either as one of tooltip options or as an object specifying cancel, edit and save separately
|
|
355
|
+
*/
|
|
356
|
+
buttonTooltipPosition: _propTypes.default.oneOfType([_propTypes.default.oneOf(['top', 'right', 'bottom', 'left']), _propTypes.default.shape({
|
|
357
|
+
cancel: _propTypes.default.oneOf(['top', 'right', 'bottom', 'left']),
|
|
358
|
+
edit: _propTypes.default.oneOf(['top', 'right', 'bottom', 'left']),
|
|
359
|
+
save: _propTypes.default.oneOf(['top', 'right', 'bottom', 'left'])
|
|
360
|
+
})]),
|
|
361
|
+
|
|
309
362
|
/**
|
|
310
363
|
* label for cancel button
|
|
311
364
|
*/
|
|
@@ -322,15 +375,14 @@ InlineEdit.propTypes = {
|
|
|
322
375
|
disabled: _propTypes.default.bool,
|
|
323
376
|
|
|
324
377
|
/**
|
|
325
|
-
*
|
|
378
|
+
* By default the edit icon is shown on hover only.
|
|
326
379
|
*/
|
|
327
|
-
|
|
380
|
+
editAlwaysVisible: _propTypes.default.bool,
|
|
328
381
|
|
|
329
382
|
/**
|
|
330
|
-
*
|
|
331
|
-
* the edit icon is redundant. E.g. a spreadsheet a property panel.
|
|
383
|
+
* Label for the edit button
|
|
332
384
|
*/
|
|
333
|
-
|
|
385
|
+
editDescription: _propTypes.default.string.isRequired,
|
|
334
386
|
|
|
335
387
|
/**
|
|
336
388
|
* ID for inline edit
|
|
@@ -365,14 +417,14 @@ InlineEdit.propTypes = {
|
|
|
365
417
|
/**
|
|
366
418
|
* method called on input event (it's a React thing onChange behaves like on input).
|
|
367
419
|
*
|
|
368
|
-
* NOTE: caller to handle invalid
|
|
420
|
+
* NOTE: caller to handle invalid states and associated text
|
|
369
421
|
*/
|
|
370
422
|
onChange: _propTypes.default.func,
|
|
371
423
|
|
|
372
424
|
/**
|
|
373
425
|
* method called on change event
|
|
374
426
|
*
|
|
375
|
-
* NOTE: caller to handle invalid
|
|
427
|
+
* NOTE: caller to handle invalid states and associated text
|
|
376
428
|
*/
|
|
377
429
|
onSave: _propTypes.default.func,
|
|
378
430
|
|
|
@@ -394,15 +446,5 @@ InlineEdit.propTypes = {
|
|
|
394
446
|
/**
|
|
395
447
|
* initial/unedited value
|
|
396
448
|
*/
|
|
397
|
-
value: _propTypes.default.string
|
|
398
|
-
|
|
399
|
-
/**
|
|
400
|
-
* set warn state for input
|
|
401
|
-
*/
|
|
402
|
-
warn: _propTypes.default.bool,
|
|
403
|
-
|
|
404
|
-
/**
|
|
405
|
-
* text shown when warn true
|
|
406
|
-
*/
|
|
407
|
-
warnText: _propTypes.default.string
|
|
449
|
+
value: _propTypes.default.string
|
|
408
450
|
};
|