@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
|
@@ -11,6 +11,8 @@ exports.default = void 0;
|
|
|
11
11
|
|
|
12
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
13
|
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
+
|
|
14
16
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
17
|
|
|
16
18
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
@@ -19,6 +21,8 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
19
21
|
|
|
20
22
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
21
23
|
|
|
24
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
25
|
+
|
|
22
26
|
var _carbonComponentsReact = require("carbon-components-react");
|
|
23
27
|
|
|
24
28
|
var _iconsReact = require("@carbon/icons-react");
|
|
@@ -37,6 +41,8 @@ var SELECT_ALL_PAGE_ROWS = 'pageRows';
|
|
|
37
41
|
var SELECT_ALL_ROWS = 'allRows';
|
|
38
42
|
|
|
39
43
|
var SelectAllWithToggle = function SelectAllWithToggle(_ref) {
|
|
44
|
+
var _columns$;
|
|
45
|
+
|
|
40
46
|
var tableId = _ref.tableId,
|
|
41
47
|
isFetching = _ref.isFetching,
|
|
42
48
|
isAllRowsSelected = _ref.isAllRowsSelected,
|
|
@@ -46,7 +52,9 @@ var SelectAllWithToggle = function SelectAllWithToggle(_ref) {
|
|
|
46
52
|
_ref$allPageRowsLabel = _ref.allPageRowsLabel,
|
|
47
53
|
allPageRowsLabel = _ref$allPageRowsLabel === void 0 ? 'Select all on page' : _ref$allPageRowsLabel,
|
|
48
54
|
_ref$allRowsLabel = _ref.allRowsLabel,
|
|
49
|
-
allRowsLabel = _ref$allRowsLabel === void 0 ? 'Select all' : _ref$allRowsLabel
|
|
55
|
+
allRowsLabel = _ref$allRowsLabel === void 0 ? 'Select all' : _ref$allRowsLabel,
|
|
56
|
+
columns = _ref.columns,
|
|
57
|
+
withStickyColumn = _ref.withStickyColumn;
|
|
50
58
|
|
|
51
59
|
var _useState = (0, _react.useState)(SELECT_ALL_PAGE_ROWS),
|
|
52
60
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -75,10 +83,11 @@ var SelectAllWithToggle = function SelectAllWithToggle(_ref) {
|
|
|
75
83
|
selectProps = (0, _objectWithoutProperties2.default)(_getProps, _excluded);
|
|
76
84
|
|
|
77
85
|
var disabled = isFetching || selectProps.disabled;
|
|
86
|
+
var isFirstColumnStickyLeft = ((_columns$ = columns[0]) === null || _columns$ === void 0 ? void 0 : _columns$.sticky) === 'left' && withStickyColumn;
|
|
78
87
|
return /*#__PURE__*/_react.default.createElement("th", {
|
|
79
88
|
role: "columnheader",
|
|
80
89
|
scope: "col",
|
|
81
|
-
className: "".concat(blockClass, "__select-all-toggle-on")
|
|
90
|
+
className: (0, _classnames.default)("".concat(blockClass, "__select-all-toggle-on"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__select-all-sticky-left"), isFirstColumnStickyLeft))
|
|
82
91
|
}, /*#__PURE__*/_react.default.createElement("span", null, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Checkbox, (0, _extends2.default)({}, selectProps, {
|
|
83
92
|
name: "".concat(tableId, "-select-all-checkbox-name"),
|
|
84
93
|
onClick: function onClick(e) {
|
|
@@ -126,12 +135,14 @@ var SelectAllWithToggle = function SelectAllWithToggle(_ref) {
|
|
|
126
135
|
SelectAllWithToggle.propTypes = {
|
|
127
136
|
allPageRowsLabel: _propTypes.default.string,
|
|
128
137
|
allRowsLabel: _propTypes.default.string,
|
|
138
|
+
columns: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
129
139
|
getToggleAllPageRowsSelectedProps: _propTypes.default.func.isRequired,
|
|
130
140
|
getToggleAllRowsSelectedProps: _propTypes.default.func.isRequired,
|
|
131
141
|
isAllRowsSelected: _propTypes.default.bool.isRequired,
|
|
132
142
|
isFetching: _propTypes.default.bool,
|
|
133
143
|
selectAllToggle: _propTypes.default.object,
|
|
134
|
-
tableId: _propTypes.default.string.isRequired
|
|
144
|
+
tableId: _propTypes.default.string.isRequired,
|
|
145
|
+
withStickyColumn: _propTypes.default.bool
|
|
135
146
|
};
|
|
136
147
|
var _default = SelectAllWithToggle;
|
|
137
148
|
exports.default = _default;
|
|
@@ -45,6 +45,8 @@ var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
|
|
|
45
45
|
var DRAG_TYPE = "".concat(blockClass, "__shared-ui-draggable-element");
|
|
46
46
|
|
|
47
47
|
var DraggableElement = function DraggableElement(_ref) {
|
|
48
|
+
var _cx;
|
|
49
|
+
|
|
48
50
|
var id = _ref.id,
|
|
49
51
|
index = _ref.index,
|
|
50
52
|
listData = _ref.listData,
|
|
@@ -56,6 +58,7 @@ var DraggableElement = function DraggableElement(_ref) {
|
|
|
56
58
|
onArrowKeyDown = _ref.onArrowKeyDown,
|
|
57
59
|
isFocused = _ref.isFocused,
|
|
58
60
|
moveElement = _ref.moveElement,
|
|
61
|
+
selected = _ref.selected,
|
|
59
62
|
_ref$positionLabel = _ref.positionLabel,
|
|
60
63
|
positionLabel = _ref$positionLabel === void 0 ? 'Current position {index} of {total}' : _ref$positionLabel,
|
|
61
64
|
_ref$grabbedLabel = _ref.grabbedLabel,
|
|
@@ -142,7 +145,7 @@ var DraggableElement = function DraggableElement(_ref) {
|
|
|
142
145
|
}, "".concat(blockClass, "__draggable-handleStyle"))
|
|
143
146
|
}, /*#__PURE__*/React.createElement(_iconsReact.Draggable16, null)), children);
|
|
144
147
|
return /*#__PURE__*/React.createElement("li", {
|
|
145
|
-
className: (0, _classnames.default)((0, _defineProperty2.default)(
|
|
148
|
+
className: (0, _classnames.default)((_cx = {}, (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__draggable-handleHolder-isOver"), isOver && !disabled), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__draggable-handleHolder-grabbed"), isGrabbed), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__draggable-handleHolder-selected"), selected), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__draggable-handleHolder"), !selected), _cx)),
|
|
146
149
|
ref: ref,
|
|
147
150
|
"aria-selected": isFocused,
|
|
148
151
|
role: "option",
|
|
@@ -196,6 +199,7 @@ DraggableElement.propTypes = {
|
|
|
196
199
|
onArrowKeyDown: _propTypes.default.func.isRequired,
|
|
197
200
|
onGrab: _propTypes.default.func.isRequired,
|
|
198
201
|
positionLabel: _propTypes.default.string,
|
|
202
|
+
selected: _propTypes.default.bool,
|
|
199
203
|
type: _propTypes.default.string.isRequired
|
|
200
204
|
};
|
|
201
205
|
var _default = DraggableElement;
|
|
@@ -9,45 +9,35 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports.default = void 0;
|
|
11
11
|
|
|
12
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
-
|
|
14
|
-
var _iconsReact = require("@carbon/icons-react");
|
|
15
|
-
|
|
16
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
13
|
|
|
18
14
|
var _carbonComponentsReact = require("carbon-components-react");
|
|
19
15
|
|
|
20
16
|
var React = _interopRequireWildcard(require("react"));
|
|
21
17
|
|
|
22
|
-
var _keyBy = _interopRequireDefault(require("lodash/keyBy"));
|
|
23
|
-
|
|
24
18
|
var _settings = require("../../../../../settings");
|
|
25
19
|
|
|
26
|
-
var _common = require("./common");
|
|
27
|
-
|
|
28
20
|
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); }
|
|
29
21
|
|
|
30
22
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
23
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
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; }
|
|
24
|
+
// @flow
|
|
35
25
|
|
|
26
|
+
/*
|
|
27
|
+
* Licensed Materials - Property of IBM
|
|
28
|
+
* 5724-Q36
|
|
29
|
+
* (c) Copyright IBM Corp. 2021
|
|
30
|
+
* US Government Users Restricted Rights - Use, duplication or disclosure
|
|
31
|
+
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
|
32
|
+
*/
|
|
36
33
|
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
|
|
37
34
|
|
|
38
35
|
var Actions = function Actions(_ref) {
|
|
39
36
|
var searchText = _ref.searchText,
|
|
40
|
-
columns = _ref.columns,
|
|
41
|
-
originalColumnDefinitions = _ref.originalColumnDefinitions,
|
|
42
|
-
setColumnsObject = _ref.setColumnsObject,
|
|
43
37
|
setSearchText = _ref.setSearchText,
|
|
44
|
-
|
|
45
|
-
findColumnPlaceholderLabel = _ref$findColumnPlaceh === void 0 ? 'Find column' : _ref$findColumnPlaceh,
|
|
46
|
-
_ref$resetToDefaultLa = _ref.resetToDefaultLabel,
|
|
47
|
-
resetToDefaultLabel = _ref$resetToDefaultLa === void 0 ? 'Reset to default' : _ref$resetToDefaultLa;
|
|
38
|
+
findColumnPlaceholderLabel = _ref.findColumnPlaceholderLabel;
|
|
48
39
|
return /*#__PURE__*/React.createElement("div", {
|
|
49
|
-
className: "".concat(blockClass, "__customize-columns-modal--actions")
|
|
50
|
-
"test-id": "".concat(blockClass, "__customize-columns-modal--actions")
|
|
40
|
+
className: "".concat(blockClass, "__customize-columns-modal--actions")
|
|
51
41
|
}, /*#__PURE__*/React.createElement(_carbonComponentsReact.Search, {
|
|
52
42
|
placeholder: findColumnPlaceholderLabel,
|
|
53
43
|
value: searchText,
|
|
@@ -56,27 +46,8 @@ var Actions = function Actions(_ref) {
|
|
|
56
46
|
onChange: function onChange(e) {
|
|
57
47
|
// TODO: is it performant?
|
|
58
48
|
setSearchText(e.target.value);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
}), /*#__PURE__*/React.createElement(_carbonComponentsReact.Button, {
|
|
62
|
-
onClick: function onClick() {
|
|
63
|
-
var reset = resetToOriginal(columns, originalColumnDefinitions);
|
|
64
|
-
setColumnsObject(reset);
|
|
65
|
-
},
|
|
66
|
-
size: "sm",
|
|
67
|
-
kind: "ghost",
|
|
68
|
-
renderIcon: _iconsReact.Reset16,
|
|
69
|
-
"test-id": "".concat(blockClass, "__customize-columns-modal--reset")
|
|
70
|
-
}, resetToDefaultLabel));
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
var resetToOriginal = function resetToOriginal(columnDefinitions, originalColumnDefinitions) {
|
|
74
|
-
var keyedDefs = (0, _keyBy.default)(columnDefinitions, 'id');
|
|
75
|
-
return originalColumnDefinitions.map(function (colDef) {
|
|
76
|
-
return _objectSpread(_objectSpread({}, keyedDefs[colDef.id]), {}, {
|
|
77
|
-
isVisible: (0, _common.isColumnVisible)(colDef)
|
|
78
|
-
});
|
|
79
|
-
});
|
|
49
|
+
}
|
|
50
|
+
}));
|
|
80
51
|
};
|
|
81
52
|
|
|
82
53
|
Actions.propTypes = {
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
|
8
6
|
value: true
|
|
9
7
|
});
|
|
10
8
|
exports.default = void 0;
|
|
11
9
|
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
12
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
15
|
|
|
16
16
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
17
|
|
|
@@ -29,9 +29,7 @@ var _DraggableElement = _interopRequireDefault(require("../../DraggableElement")
|
|
|
29
29
|
|
|
30
30
|
var _common = require("./common");
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
32
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
35
33
|
|
|
36
34
|
// @flow
|
|
37
35
|
|
|
@@ -59,36 +57,39 @@ var getNextIndex = function getNextIndex(array, currentIndex, key) {
|
|
|
59
57
|
};
|
|
60
58
|
|
|
61
59
|
var Columns = function Columns(_ref) {
|
|
62
|
-
var
|
|
60
|
+
var _classNames;
|
|
61
|
+
|
|
62
|
+
var getVisibleColumnsCount = _ref.getVisibleColumnsCount,
|
|
63
|
+
filterString = _ref.filterString,
|
|
63
64
|
columns = _ref.columns,
|
|
64
65
|
setColumnsObject = _ref.setColumnsObject,
|
|
65
66
|
onSelectColumn = _ref.onSelectColumn,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
disabledInstructionsLabel = _ref$disabledInstruct === void 0 ? 'Reordering columns are disabled because they are filtered currently.' : _ref$disabledInstruct;
|
|
67
|
+
assistiveTextInstructionsLabel = _ref.assistiveTextInstructionsLabel,
|
|
68
|
+
assistiveTextDisabledInstructionsLabel = _ref.assistiveTextDisabledInstructionsLabel,
|
|
69
|
+
selectAllLabel = _ref.selectAllLabel;
|
|
70
70
|
|
|
71
|
-
var _React$useState =
|
|
71
|
+
var _React$useState = _react.default.useState(''),
|
|
72
72
|
_React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
|
|
73
73
|
ariaRegionText = _React$useState2[0],
|
|
74
74
|
setAriaRegionText = _React$useState2[1];
|
|
75
75
|
|
|
76
|
-
var _React$useState3 =
|
|
76
|
+
var _React$useState3 = _react.default.useState(-1),
|
|
77
77
|
_React$useState4 = (0, _slicedToArray2.default)(_React$useState3, 2),
|
|
78
78
|
focusIndex = _React$useState4[0],
|
|
79
79
|
setFocusIndex = _React$useState4[1];
|
|
80
80
|
|
|
81
|
-
var moveElement =
|
|
81
|
+
var moveElement = _react.default.useCallback(function (dragIndex, hoverIndex) {
|
|
82
82
|
var dragCard = columns[dragIndex];
|
|
83
83
|
setColumnsObject((0, _immutabilityHelper.default)(columns, {
|
|
84
84
|
$splice: [[dragIndex, 1], [hoverIndex, 0, dragCard]]
|
|
85
85
|
}));
|
|
86
86
|
}, [columns, setColumnsObject]);
|
|
87
|
-
|
|
87
|
+
|
|
88
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
88
89
|
className: "".concat(blockClass, "__customize-columns-column-list")
|
|
89
|
-
}, /*#__PURE__*/
|
|
90
|
+
}, /*#__PURE__*/_react.default.createElement(_reactDnd.DndProvider, {
|
|
90
91
|
backend: _reactDndHtml5Backend.HTML5Backend
|
|
91
|
-
}, /*#__PURE__*/
|
|
92
|
+
}, /*#__PURE__*/_react.default.createElement("ol", {
|
|
92
93
|
className: "".concat(blockClass, "__customize-columns-column-list--focus"),
|
|
93
94
|
role: "listbox",
|
|
94
95
|
"aria-describedby": "".concat(blockClass, "__customize-columns--instructions"),
|
|
@@ -107,16 +108,30 @@ var Columns = function Columns(_ref) {
|
|
|
107
108
|
setFocusIndex(0);
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
|
-
}, /*#__PURE__*/
|
|
111
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
111
112
|
"aria-live": "assertive",
|
|
112
113
|
className: "".concat(blockClass, "__shared-ui--assistive-text")
|
|
113
|
-
}, ariaRegionText), /*#__PURE__*/
|
|
114
|
+
}, ariaRegionText), /*#__PURE__*/_react.default.createElement("span", {
|
|
114
115
|
id: "".concat(blockClass, "__customize-columns--instructions"),
|
|
115
116
|
className: "".concat(blockClass, "__shared-ui--assistive-text")
|
|
116
|
-
}, filterString.length === 0 ?
|
|
117
|
+
}, filterString.length === 0 ? assistiveTextInstructionsLabel : assistiveTextDisabledInstructionsLabel), /*#__PURE__*/_react.default.createElement("div", {
|
|
118
|
+
id: "".concat(blockClass, "__customize-columns-select-all"),
|
|
119
|
+
className: (0, _classnames.default)((_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(blockClass, "__customize-columns-select-all"), getVisibleColumnsCount() === 0), (0, _defineProperty2.default)(_classNames, "".concat(blockClass, "__customize-columns-select-all-selected"), getVisibleColumnsCount() > 0), _classNames)),
|
|
120
|
+
selected: getVisibleColumnsCount() > 0
|
|
121
|
+
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Checkbox, {
|
|
122
|
+
wrapperClassName: "".concat(blockClass, "__customize-columns-checkbox-wrapper"),
|
|
123
|
+
checked: getVisibleColumnsCount() === columns.length,
|
|
124
|
+
empty: !!getVisibleColumnsCount() === 0,
|
|
125
|
+
indeterminate: getVisibleColumnsCount() < columns.length && getVisibleColumnsCount() > 0,
|
|
126
|
+
onChange: function onChange() {
|
|
127
|
+
onSelectColumn(columns, getVisibleColumnsCount() !== columns.length);
|
|
128
|
+
},
|
|
129
|
+
id: "".concat(blockClass, "__customization-column-select-all"),
|
|
130
|
+
labelText: selectAllLabel
|
|
131
|
+
})), columns.filter(function (colDef) {
|
|
117
132
|
return filterString.length === 0 || colDef.Header.props.title.toLowerCase().includes(filterString);
|
|
118
133
|
}).map(function (colDef, i) {
|
|
119
|
-
return /*#__PURE__*/
|
|
134
|
+
return /*#__PURE__*/_react.default.createElement(_DraggableElement.default, {
|
|
120
135
|
key: colDef.id,
|
|
121
136
|
index: i,
|
|
122
137
|
listData: columns,
|
|
@@ -142,24 +157,31 @@ var Columns = function Columns(_ref) {
|
|
|
142
157
|
});
|
|
143
158
|
}
|
|
144
159
|
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
|
|
160
|
+
},
|
|
161
|
+
selected: (0, _common.isColumnVisible)(colDef)
|
|
162
|
+
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Checkbox, {
|
|
163
|
+
wrapperClassName: "".concat(blockClass, "__customize-columns-checkbox-wrapper"),
|
|
148
164
|
checked: (0, _common.isColumnVisible)(colDef),
|
|
149
165
|
onChange: onSelectColumn.bind(null, colDef),
|
|
150
166
|
id: "".concat(blockClass, "__customization-column-").concat(colDef.id),
|
|
151
167
|
labelText: colDef.Header.props.title,
|
|
152
|
-
title: colDef.Header.props.title
|
|
168
|
+
title: colDef.Header.props.title,
|
|
169
|
+
className: "".concat(blockClass, "__customize-columns-checkbox")
|
|
153
170
|
}));
|
|
154
171
|
}))));
|
|
155
172
|
};
|
|
156
173
|
|
|
157
174
|
Columns.propTypes = {
|
|
175
|
+
assistiveTextDisabledInstructionsLabel: _propTypes.default.string,
|
|
176
|
+
assistiveTextInstructionsLabel: _propTypes.default.string,
|
|
158
177
|
columns: _propTypes.default.array.isRequired,
|
|
159
178
|
disabledInstructionsLabel: _propTypes.default.string,
|
|
160
179
|
filterString: _propTypes.default.string.isRequired,
|
|
180
|
+
getVisibleColumnsCount: _propTypes.default.func.isRequired,
|
|
161
181
|
instructionsLabel: _propTypes.default.string,
|
|
162
182
|
onSelectColumn: _propTypes.default.func.isRequired,
|
|
183
|
+
selectAllLabel: _propTypes.default.string,
|
|
184
|
+
setColumnStatus: _propTypes.default.func,
|
|
163
185
|
setColumnsObject: _propTypes.default.func.isRequired
|
|
164
186
|
};
|
|
165
187
|
var _default = Columns;
|
|
@@ -44,20 +44,40 @@ var CustomizeColumnsModal = function CustomizeColumnsModal(_ref) {
|
|
|
44
44
|
columnDefinitions = _ref.columnDefinitions,
|
|
45
45
|
originalColumnDefinitions = _ref.originalColumnDefinitions,
|
|
46
46
|
_ref$customizeModalHe = _ref.customizeModalHeadingLabel,
|
|
47
|
-
customizeModalHeadingLabel = _ref$customizeModalHe === void 0 ? 'Customize
|
|
47
|
+
customizeModalHeadingLabel = _ref$customizeModalHe === void 0 ? 'Customize Columns' : _ref$customizeModalHe,
|
|
48
48
|
_ref$primaryButtonTex = _ref.primaryButtonTextLabel,
|
|
49
49
|
primaryButtonTextLabel = _ref$primaryButtonTex === void 0 ? 'Save' : _ref$primaryButtonTex,
|
|
50
50
|
_ref$secondaryButtonT = _ref.secondaryButtonTextLabel,
|
|
51
51
|
secondaryButtonTextLabel = _ref$secondaryButtonT === void 0 ? 'Cancel' : _ref$secondaryButtonT,
|
|
52
52
|
_ref$instructionsLabe = _ref.instructionsLabel,
|
|
53
|
-
instructionsLabel = _ref$instructionsLabe === void 0 ? '
|
|
53
|
+
instructionsLabel = _ref$instructionsLabe === void 0 ? 'Select columns to display them. Click and drag the box to reorder the columns. These specifications will be saved and persist if you leave and return to the data table.' : _ref$instructionsLabe,
|
|
54
|
+
_ref$findColumnPlaceh = _ref.findColumnPlaceholderLabel,
|
|
55
|
+
findColumnPlaceholderLabel = _ref$findColumnPlaceh === void 0 ? 'Find column' : _ref$findColumnPlaceh,
|
|
56
|
+
_ref$resetToDefaultLa = _ref.resetToDefaultLabel,
|
|
57
|
+
resetToDefaultLabel = _ref$resetToDefaultLa === void 0 ? 'Reset to default' : _ref$resetToDefaultLa,
|
|
58
|
+
_ref$assistiveTextIns = _ref.assistiveTextInstructionsLabel,
|
|
59
|
+
assistiveTextInstructionsLabel = _ref$assistiveTextIns === void 0 ? 'Press space bar to toggle drag drop mode, use arrow keys to move selected elements.' : _ref$assistiveTextIns,
|
|
60
|
+
_ref$assistiveTextDis = _ref.assistiveTextDisabledInstructionsLabel,
|
|
61
|
+
assistiveTextDisabledInstructionsLabel = _ref$assistiveTextDis === void 0 ? 'Reordering columns are disabled because they are filtered currently.' : _ref$assistiveTextDis,
|
|
62
|
+
_ref$selectAllLabel = _ref.selectAllLabel,
|
|
63
|
+
selectAllLabel = _ref$selectAllLabel === void 0 ? 'Column name' : _ref$selectAllLabel;
|
|
54
64
|
|
|
55
65
|
var _useState = (0, _react.useState)(''),
|
|
56
66
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
57
|
-
|
|
58
|
-
|
|
67
|
+
visibleColumnsCount = _useState2[0],
|
|
68
|
+
setVisibleColumnsCount = _useState2[1];
|
|
59
69
|
|
|
60
|
-
var _useState3 = (0, _react.useState)(
|
|
70
|
+
var _useState3 = (0, _react.useState)(''),
|
|
71
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
72
|
+
totalColumns = _useState4[0],
|
|
73
|
+
setTotalColumns = _useState4[1];
|
|
74
|
+
|
|
75
|
+
var _useState5 = (0, _react.useState)(''),
|
|
76
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
77
|
+
searchText = _useState6[0],
|
|
78
|
+
setSearchText = _useState6[1];
|
|
79
|
+
|
|
80
|
+
var _useState7 = (0, _react.useState)(columnDefinitions // hide the columns without Header, e.g the sticky actions, spacer
|
|
61
81
|
.filter(function (colDef) {
|
|
62
82
|
return !!colDef.Header.props;
|
|
63
83
|
}) // only sort the hidden column to the end when modal reopen
|
|
@@ -75,14 +95,14 @@ var CustomizeColumnsModal = function CustomizeColumnsModal(_ref) {
|
|
|
75
95
|
|
|
76
96
|
return 0;
|
|
77
97
|
})),
|
|
78
|
-
|
|
79
|
-
columnObjects =
|
|
80
|
-
|
|
98
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
99
|
+
columnObjects = _useState8[0],
|
|
100
|
+
setColumnObjects = _useState8[1];
|
|
81
101
|
|
|
82
|
-
var
|
|
83
|
-
|
|
84
|
-
isDirty =
|
|
85
|
-
setIsDirty =
|
|
102
|
+
var _useState9 = (0, _react.useState)(false),
|
|
103
|
+
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
104
|
+
isDirty = _useState10[0],
|
|
105
|
+
setIsDirty = _useState10[1];
|
|
86
106
|
|
|
87
107
|
var onRequestClose = function onRequestClose() {
|
|
88
108
|
setIsModalOpen(false);
|
|
@@ -101,7 +121,7 @@ var CustomizeColumnsModal = function CustomizeColumnsModal(_ref) {
|
|
|
101
121
|
|
|
102
122
|
var onCheckboxCheck = function onCheckboxCheck(col, value) {
|
|
103
123
|
var changedDefinitions = columnObjects.map(function (definition) {
|
|
104
|
-
if (definition.id === col.id) {
|
|
124
|
+
if (Array.isArray(col) && col.indexOf(definition) != null || definition.id === col.id) {
|
|
105
125
|
return _objectSpread(_objectSpread({}, definition), {}, {
|
|
106
126
|
isVisible: value
|
|
107
127
|
});
|
|
@@ -109,9 +129,7 @@ var CustomizeColumnsModal = function CustomizeColumnsModal(_ref) {
|
|
|
109
129
|
|
|
110
130
|
return definition;
|
|
111
131
|
});
|
|
112
|
-
|
|
113
|
-
_setColumnsObject(changedDefinitions);
|
|
114
|
-
|
|
132
|
+
setColumnObjects(changedDefinitions);
|
|
115
133
|
setDirty();
|
|
116
134
|
};
|
|
117
135
|
|
|
@@ -121,11 +139,20 @@ var CustomizeColumnsModal = function CustomizeColumnsModal(_ref) {
|
|
|
121
139
|
}
|
|
122
140
|
};
|
|
123
141
|
|
|
142
|
+
var getVisibleColumnsCount = (0, _react.useCallback)(function () {
|
|
143
|
+
return columnObjects.filter(function (col) {
|
|
144
|
+
return col.isVisible;
|
|
145
|
+
}).length;
|
|
146
|
+
}, [columnObjects]);
|
|
124
147
|
var string = searchText.trim().toLowerCase();
|
|
148
|
+
(0, _react.useEffect)(function () {
|
|
149
|
+
setVisibleColumnsCount(getVisibleColumnsCount());
|
|
150
|
+
setTotalColumns(columnObjects.length);
|
|
151
|
+
}, [getVisibleColumnsCount, columnObjects.length]);
|
|
125
152
|
return /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Modal, {
|
|
126
153
|
className: "".concat(blockClass, "__customize-columns-modal"),
|
|
127
154
|
open: isOpen,
|
|
128
|
-
modalHeading: customizeModalHeadingLabel,
|
|
155
|
+
modalHeading: "".concat(customizeModalHeadingLabel, " (").concat(visibleColumnsCount, "/").concat(totalColumns, ")"),
|
|
129
156
|
primaryButtonText: primaryButtonTextLabel,
|
|
130
157
|
secondaryButtonText: secondaryButtonTextLabel,
|
|
131
158
|
selectorPrimaryFocus: ".".concat(blockClass, "__customize-columns-column-list--focus"),
|
|
@@ -141,32 +168,41 @@ var CustomizeColumnsModal = function CustomizeColumnsModal(_ref) {
|
|
|
141
168
|
originalColumnDefinitions: originalColumnDefinitions,
|
|
142
169
|
searchText: searchText,
|
|
143
170
|
setColumnsObject: function setColumnsObject(cols) {
|
|
144
|
-
|
|
145
|
-
|
|
171
|
+
setColumnObjects(cols);
|
|
146
172
|
setDirty();
|
|
147
173
|
},
|
|
148
|
-
setSearchText: setSearchText
|
|
174
|
+
setSearchText: setSearchText,
|
|
175
|
+
findColumnPlaceholderLabel: findColumnPlaceholderLabel,
|
|
176
|
+
resetToDefaultLabel: resetToDefaultLabel
|
|
149
177
|
}), isOpen && /*#__PURE__*/_react.default.createElement(_Columns.default, {
|
|
178
|
+
assistiveTextInstructionsLabel: assistiveTextInstructionsLabel,
|
|
179
|
+
assistiveTextDisabledInstructionsLabel: assistiveTextDisabledInstructionsLabel,
|
|
180
|
+
getVisibleColumnsCount: getVisibleColumnsCount,
|
|
150
181
|
columns: columnObjects,
|
|
151
182
|
filterString: string,
|
|
152
183
|
onSelectColumn: onCheckboxCheck,
|
|
153
184
|
setColumnsObject: function setColumnsObject(cols) {
|
|
154
|
-
|
|
155
|
-
|
|
185
|
+
setColumnObjects(cols);
|
|
156
186
|
setDirty();
|
|
157
|
-
}
|
|
187
|
+
},
|
|
188
|
+
selectAllLabel: selectAllLabel
|
|
158
189
|
}));
|
|
159
190
|
};
|
|
160
191
|
|
|
161
192
|
CustomizeColumnsModal.propTypes = {
|
|
193
|
+
assistiveTextDisabledInstructionsLabel: _propTypes.default.string,
|
|
194
|
+
assistiveTextInstructionsLabel: _propTypes.default.string,
|
|
162
195
|
columnDefinitions: _propTypes.default.array.isRequired,
|
|
163
196
|
customizeModalHeadingLabel: _propTypes.default.string,
|
|
197
|
+
findColumnPlaceholderLabel: _propTypes.default.string,
|
|
164
198
|
instructionsLabel: _propTypes.default.string,
|
|
165
199
|
isOpen: _propTypes.default.bool.isRequired,
|
|
166
200
|
onSaveColumnPrefs: _propTypes.default.func.isRequired,
|
|
167
201
|
originalColumnDefinitions: _propTypes.default.array.isRequired,
|
|
168
202
|
primaryButtonTextLabel: _propTypes.default.string,
|
|
203
|
+
resetToDefaultLabel: _propTypes.default.string,
|
|
169
204
|
secondaryButtonTextLabel: _propTypes.default.string,
|
|
205
|
+
selectAllLabel: _propTypes.default.string,
|
|
170
206
|
setIsModalOpen: _propTypes.default.func.isRequired
|
|
171
207
|
};
|
|
172
208
|
var _default = CustomizeColumnsModal;
|
|
@@ -19,7 +19,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
19
19
|
|
|
20
20
|
var _CustomizeColumnsModal = _interopRequireDefault(require("./CustomizeColumnsModal"));
|
|
21
21
|
|
|
22
|
-
var _excluded = ["onSaveColumnPrefs", "isModalOpen", "setIsModalOpen"];
|
|
22
|
+
var _excluded = ["onSaveColumnPrefs", "isModalOpen", "setIsModalOpen", "labels"];
|
|
23
23
|
|
|
24
24
|
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); }
|
|
25
25
|
|
|
@@ -31,10 +31,11 @@ var ModalWrapper = function ModalWrapper(_ref) {
|
|
|
31
31
|
_onSaveColumnPrefs = _instance$customizeCo.onSaveColumnPrefs,
|
|
32
32
|
isModalOpen = _instance$customizeCo.isModalOpen,
|
|
33
33
|
setIsModalOpen = _instance$customizeCo.setIsModalOpen,
|
|
34
|
+
labels = _instance$customizeCo.labels,
|
|
34
35
|
rest = (0, _objectWithoutProperties2.default)(_instance$customizeCo, _excluded);
|
|
35
36
|
|
|
36
37
|
if (isModalOpen) {
|
|
37
|
-
return /*#__PURE__*/React.createElement(_CustomizeColumnsModal.default, (0, _extends2.default)({}, rest, {
|
|
38
|
+
return /*#__PURE__*/React.createElement(_CustomizeColumnsModal.default, (0, _extends2.default)({}, rest, labels, {
|
|
38
39
|
isOpen: isModalOpen,
|
|
39
40
|
setIsModalOpen: setIsModalOpen,
|
|
40
41
|
columnDefinitions: instance.allColumns,
|
package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.InlineEditButton = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
|
|
14
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
+
|
|
16
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
+
|
|
18
|
+
var _settings = require("../../../../../../settings");
|
|
19
|
+
|
|
20
|
+
/*
|
|
21
|
+
* Licensed Materials - Property of IBM
|
|
22
|
+
* 5724-Q36
|
|
23
|
+
* (c) Copyright IBM Corp. 2022
|
|
24
|
+
* US Government Users Restricted Rights - Use, duplication or disclosure
|
|
25
|
+
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
|
26
|
+
*/
|
|
27
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
|
|
28
|
+
|
|
29
|
+
var InlineEditButton = function InlineEditButton(_ref) {
|
|
30
|
+
var _cx, _cx2;
|
|
31
|
+
|
|
32
|
+
var label = _ref.label,
|
|
33
|
+
Icon = _ref.renderIcon,
|
|
34
|
+
disabled = _ref.disabled,
|
|
35
|
+
LabelIcon = _ref.labelIcon,
|
|
36
|
+
placeholder = _ref.placeholder,
|
|
37
|
+
nonEditCell = _ref.nonEditCell,
|
|
38
|
+
isActiveCell = _ref.isActiveCell,
|
|
39
|
+
columnConfig = _ref.columnConfig,
|
|
40
|
+
totalInlineEditColumns = _ref.totalInlineEditColumns,
|
|
41
|
+
totalColumns = _ref.totalColumns,
|
|
42
|
+
type = _ref.type;
|
|
43
|
+
var inlineEditColsLessThanHalfOfTotal = totalInlineEditColumns < totalColumns / 2;
|
|
44
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
45
|
+
className: (0, _classnames.default)("".concat(blockClass, "__inline-edit-button"), (_cx = {}, (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__inline-edit-button--disabled"), disabled || nonEditCell), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__inline-edit-button--with-label-icon"), LabelIcon), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__inline-edit-button--non-edit"), nonEditCell), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__inline-edit-button--active"), isActiveCell), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__inline-edit-button--edit-less-than-half-of-total-cols"), inlineEditColsLessThanHalfOfTotal), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "__inline-edit-button--").concat(type), type === 'date' || type === 'selection'), _cx)),
|
|
46
|
+
tabIndex: isActiveCell ? 0 : -1,
|
|
47
|
+
"data-disabled": disabled || nonEditCell,
|
|
48
|
+
"aria-disabled": disabled || nonEditCell,
|
|
49
|
+
role: "button",
|
|
50
|
+
title: label
|
|
51
|
+
}, LabelIcon && /*#__PURE__*/_react.default.createElement("div", {
|
|
52
|
+
className: "".concat(blockClass, "__label-icon")
|
|
53
|
+
}, /*#__PURE__*/_react.default.createElement(LabelIcon, null)), label !== '' ? /*#__PURE__*/_react.default.createElement("span", {
|
|
54
|
+
className: (0, _classnames.default)("".concat(blockClass, "__inline-edit-button-label"), (_cx2 = {}, (0, _defineProperty2.default)(_cx2, "".concat(blockClass, "__inline-edit-button-label-with-icon"), !nonEditCell), (0, _defineProperty2.default)(_cx2, "".concat(blockClass, "__defaultStringRenderer--multiline"), columnConfig === null || columnConfig === void 0 ? void 0 : columnConfig.multiLineWrap), _cx2))
|
|
55
|
+
}, label) : /*#__PURE__*/_react.default.createElement("span", {
|
|
56
|
+
className: "".concat(blockClass, "__placeholder")
|
|
57
|
+
}, placeholder), !nonEditCell && Icon && /*#__PURE__*/_react.default.createElement("div", {
|
|
58
|
+
className: "".concat(blockClass, "__inline-edit-button-icon")
|
|
59
|
+
}, /*#__PURE__*/_react.default.createElement(Icon, null)));
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
exports.InlineEditButton = InlineEditButton;
|
|
63
|
+
InlineEditButton.propTypes = {
|
|
64
|
+
columnConfig: _propTypes.default.object,
|
|
65
|
+
disabled: _propTypes.default.bool,
|
|
66
|
+
isActiveCell: _propTypes.default.bool,
|
|
67
|
+
label: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
68
|
+
labelIcon: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
69
|
+
nonEditCell: _propTypes.default.bool,
|
|
70
|
+
placeholder: _propTypes.default.string,
|
|
71
|
+
renderIcon: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
72
|
+
totalColumns: _propTypes.default.number,
|
|
73
|
+
totalInlineEditColumns: _propTypes.default.number,
|
|
74
|
+
type: _propTypes.default.oneOf(['text', 'number', 'selection', 'date']),
|
|
75
|
+
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node])
|
|
76
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "InlineEditButton", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _InlineEditButton.InlineEditButton;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
var _InlineEditButton = require("./InlineEditButton");
|