@carbon/ibm-products 1.60.0 → 1.61.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +57 -24
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +4 -4
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +9 -3
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +47 -9
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +2 -2
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +47 -24
- 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/Datagrid/Datagrid/DatagridContent.js +3 -1
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +2 -2
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +9 -8
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +6 -12
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +0 -5
- package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +17 -5
- package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +4 -3
- package/es/components/Datagrid/useInlineEdit.js +1 -6
- package/es/components/Datagrid/useSortableColumns.js +5 -4
- package/es/components/FilterSummary/FilterSummary.js +6 -2
- package/es/components/TagSet/TagSet.js +11 -3
- package/es/components/TagSet/TagSetOverflow.js +16 -5
- package/es/global/js/utils/getNodeTextContent.js +51 -0
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +3 -1
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +2 -2
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +9 -8
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +6 -12
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +0 -5
- package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +15 -3
- package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +7 -3
- package/lib/components/Datagrid/useInlineEdit.js +1 -6
- package/lib/components/Datagrid/useSortableColumns.js +5 -4
- package/lib/components/FilterSummary/FilterSummary.js +6 -2
- package/lib/components/TagSet/TagSet.js +11 -3
- package/lib/components/TagSet/TagSetOverflow.js +16 -5
- package/lib/global/js/utils/getNodeTextContent.js +59 -0
- package/package.json +4 -4
- package/scss/components/Datagrid/_datagrid.scss +1 -0
- package/scss/components/Datagrid/styles/_useInlineEdit.scss +7 -11
- package/scss/components/Datagrid/styles/addons/_RowSizeDropdown.scss +42 -1
- package/scss/components/TagSet/_tag-set.scss +13 -3
- package/es/components/Datagrid/utils/getColTitle.js +0 -25
- package/lib/components/Datagrid/utils/getColTitle.js +0 -32
@@ -35,14 +35,12 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
35
35
|
tabIndex = _ref.tabIndex,
|
36
36
|
value = _ref.value,
|
37
37
|
nonEditCell = _ref.nonEditCell,
|
38
|
-
totalInlineEditColumns = _ref.totalInlineEditColumns,
|
39
38
|
type = _ref.type;
|
40
39
|
var columnId = cell.column.id;
|
41
40
|
var columnIndex = instance.columns.findIndex(function (col) {
|
42
41
|
return col.id === columnId;
|
43
42
|
});
|
44
43
|
var cellId = "column-".concat(columnIndex, "-row-").concat(cell.row.index);
|
45
|
-
var totalColumns = instance.columns.length;
|
46
44
|
var _useContext = (0, _react.useContext)(_InlineEditContext.InlineEditContext),
|
47
45
|
state = _useContext.state,
|
48
46
|
dispatch = _useContext.dispatch;
|
@@ -445,8 +443,6 @@ var InlineEditCell = function InlineEditCell(_ref) {
|
|
445
443
|
tabIndex: tabIndex,
|
446
444
|
nonEditCell: nonEditCell,
|
447
445
|
columnConfig: cell.column,
|
448
|
-
totalInlineEditColumns: totalInlineEditColumns,
|
449
|
-
totalColumns: totalColumns,
|
450
446
|
type: type
|
451
447
|
}), !nonEditCell && inEditMode && cellId === activeCellId && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, type === 'text' && renderTextInput(), type === 'number' && renderNumberInput(), type === 'selection' && renderSelectCell(), type === 'date' && renderDateCell()))
|
452
448
|
);
|
@@ -465,7 +461,6 @@ InlineEditCell.propTypes = {
|
|
465
461
|
nonEditCell: _propTypes.default.bool,
|
466
462
|
placeholder: _propTypes.default.string,
|
467
463
|
tabIndex: _propTypes.default.number,
|
468
|
-
totalInlineEditColumns: _propTypes.default.number,
|
469
464
|
type: _propTypes.default.oneOf(['text', 'number', 'selection', 'date']),
|
470
465
|
value: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node, _propTypes.default.object])
|
471
466
|
};
|
@@ -23,13 +23,21 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
23
23
|
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid__row-size");
|
24
24
|
var RowSizeDropdown = function RowSizeDropdown(_ref) {
|
25
25
|
var _ref$legendText = _ref.legendText,
|
26
|
-
legendText = _ref$legendText === void 0 ? 'Row
|
26
|
+
legendText = _ref$legendText === void 0 ? 'Row settings' : _ref$legendText,
|
27
27
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
28
28
|
var buttonRef = (0, _react.useRef)(null);
|
29
|
+
var radioGroupRef = (0, _react.useRef)();
|
29
30
|
var _useState = (0, _react.useState)(false),
|
30
31
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
31
32
|
isOpen = _useState2[0],
|
32
33
|
setIsOpen = _useState2[1];
|
34
|
+
(0, _react.useEffect)(function () {
|
35
|
+
if (isOpen) {
|
36
|
+
var radioGroupParentElement = radioGroupRef === null || radioGroupRef === void 0 ? void 0 : radioGroupRef.current;
|
37
|
+
var checkedRadioChild = radioGroupParentElement === null || radioGroupParentElement === void 0 ? void 0 : radioGroupParentElement.querySelector(".".concat(_settings.carbon.prefix, "--radio-button:checked"));
|
38
|
+
checkedRadioChild === null || checkedRadioChild === void 0 ? void 0 : checkedRadioChild.focus();
|
39
|
+
}
|
40
|
+
}, [isOpen]);
|
33
41
|
var onCloseHandler = function onCloseHandler() {
|
34
42
|
setIsOpen(false);
|
35
43
|
};
|
@@ -39,7 +47,9 @@ var RowSizeDropdown = function RowSizeDropdown(_ref) {
|
|
39
47
|
}
|
40
48
|
};
|
41
49
|
var onClickHandler = function onClickHandler() {
|
42
|
-
setIsOpen(
|
50
|
+
setIsOpen(function (prev) {
|
51
|
+
return !prev;
|
52
|
+
});
|
43
53
|
};
|
44
54
|
var onKeyHandler = function onKeyHandler(e) {
|
45
55
|
if (e.key === 'Escape') {
|
@@ -62,7 +72,9 @@ var RowSizeDropdown = function RowSizeDropdown(_ref) {
|
|
62
72
|
iconDescription: legendText,
|
63
73
|
className: (0, _classnames.default)("".concat(blockClass, "-button"), (0, _defineProperty2.default)({}, "".concat(blockClass, "-button--open"), isOpen)),
|
64
74
|
onClick: onClickHandler
|
65
|
-
}), isOpen && /*#__PURE__*/_react.default.createElement(_RowSizeRadioGroup.default, (0, _extends2.default)({
|
75
|
+
}), isOpen && /*#__PURE__*/_react.default.createElement(_RowSizeRadioGroup.default, (0, _extends2.default)({
|
76
|
+
ref: radioGroupRef
|
77
|
+
}, props, {
|
66
78
|
legendText: legendText,
|
67
79
|
buttonRef: buttonRef
|
68
80
|
})));
|
@@ -1,15 +1,18 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
5
6
|
value: true
|
6
7
|
});
|
7
8
|
exports.default = void 0;
|
8
|
-
var _react =
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
9
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
10
11
|
var _carbonComponentsReact = require("carbon-components-react");
|
11
12
|
var _isArray = _interopRequireDefault(require("lodash/isArray"));
|
12
13
|
var _settings = require("../../../../../settings");
|
14
|
+
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); }
|
15
|
+
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; }
|
13
16
|
/* eslint-disable react/default-props-match-prop-types */
|
14
17
|
// @flow
|
15
18
|
/*
|
@@ -21,7 +24,7 @@ var _settings = require("../../../../../settings");
|
|
21
24
|
*/
|
22
25
|
|
23
26
|
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
|
24
|
-
var RowSizeRadioGroup = function
|
27
|
+
var RowSizeRadioGroup = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
25
28
|
var rowSizes = _ref.rowSizes,
|
26
29
|
selectedOption = _ref.selectedOption,
|
27
30
|
datagridName = _ref.datagridName,
|
@@ -36,6 +39,7 @@ var RowSizeRadioGroup = function RowSizeRadioGroup(_ref) {
|
|
36
39
|
xs: 'Extra small'
|
37
40
|
} : _ref$rowSizeLabels;
|
38
41
|
return /*#__PURE__*/_react.default.createElement("div", {
|
42
|
+
ref: ref,
|
39
43
|
className: "".concat(blockClass, "__row-size-dropdown"),
|
40
44
|
role: "presentation"
|
41
45
|
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.RadioButtonGroup, {
|
@@ -58,7 +62,7 @@ var RowSizeRadioGroup = function RowSizeRadioGroup(_ref) {
|
|
58
62
|
id: "".concat(datagridName || 'datagrid', "--row-density--").concat(option.value)
|
59
63
|
});
|
60
64
|
})));
|
61
|
-
};
|
65
|
+
});
|
62
66
|
var getBackwardCompatibleRowSize = function getBackwardCompatibleRowSize(rowSize) {
|
63
67
|
// TODO: deprecate this function in next major release (v8) on carbon-components-react
|
64
68
|
var rowSizeMap = {
|
@@ -32,14 +32,11 @@ var useInlineEdit = function useInlineEdit(hooks, usingEditableCell) {
|
|
32
32
|
}
|
33
33
|
}, [usingEditableCell]);
|
34
34
|
var addInlineEdit = function addInlineEdit(props, _ref) {
|
35
|
-
var _cell$column, _cell$column$inlineEd
|
35
|
+
var _cell$column, _cell$column$inlineEd;
|
36
36
|
var cell = _ref.cell,
|
37
37
|
instance = _ref.instance;
|
38
38
|
var columnInlineEditConfig = cell.column.inlineEdit;
|
39
39
|
var inlineEditType = (_cell$column = cell.column) === null || _cell$column === void 0 ? void 0 : (_cell$column$inlineEd = _cell$column.inlineEdit) === null || _cell$column$inlineEd === void 0 ? void 0 : _cell$column$inlineEd.type;
|
40
|
-
var totalInlineEditColumns = (_instance$columns$fil = instance.columns.filter(function (item) {
|
41
|
-
return item.inlineEdit;
|
42
|
-
})) === null || _instance$columns$fil === void 0 ? void 0 : _instance$columns$fil.length;
|
43
40
|
var renderInlineEditComponent = function renderInlineEditComponent(type) {
|
44
41
|
return /*#__PURE__*/_react.default.createElement(_InlineEditCell.InlineEditCell, {
|
45
42
|
config: columnInlineEditConfig,
|
@@ -47,7 +44,6 @@ var useInlineEdit = function useInlineEdit(hooks, usingEditableCell) {
|
|
47
44
|
value: cell.value,
|
48
45
|
cell: cell,
|
49
46
|
instance: instance,
|
50
|
-
totalInlineEditColumns: totalInlineEditColumns,
|
51
47
|
type: type
|
52
48
|
});
|
53
49
|
};
|
@@ -67,7 +63,6 @@ var useInlineEdit = function useInlineEdit(hooks, usingEditableCell) {
|
|
67
63
|
instance: instance,
|
68
64
|
disabled: true,
|
69
65
|
nonEditCell: true,
|
70
|
-
totalInlineEditColumns: totalInlineEditColumns,
|
71
66
|
type: "text"
|
72
67
|
}))
|
73
68
|
}];
|
@@ -12,6 +12,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
12
|
var _settings = require("../../settings");
|
13
13
|
var _carbonComponentsReact = require("carbon-components-react");
|
14
14
|
var _iconsReact = require("@carbon/icons-react");
|
15
|
+
var _DatagridSelectAll = require("./Datagrid/DatagridSelectAll");
|
15
16
|
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; }
|
16
17
|
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; }
|
17
18
|
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
|
@@ -31,13 +32,13 @@ var getAriaSortValue = function getAriaSortValue(col, _ref) {
|
|
31
32
|
isSorted = _ref2.isSorted,
|
32
33
|
isSortedDesc = _ref2.isSortedDesc;
|
33
34
|
if (!isSorted) {
|
34
|
-
return defaultSortableLabelText
|
35
|
+
return defaultSortableLabelText;
|
35
36
|
}
|
36
37
|
if (isSorted && !isSortedDesc) {
|
37
|
-
return ascendingSortableLabelText
|
38
|
+
return ascendingSortableLabelText;
|
38
39
|
}
|
39
40
|
if (isSorted && isSortedDesc) {
|
40
|
-
return descendingSortableLabelText
|
41
|
+
return descendingSortableLabelText;
|
41
42
|
}
|
42
43
|
};
|
43
44
|
var useSortableColumns = function useSortableColumns(hooks) {
|
@@ -91,7 +92,7 @@ var useSortableColumns = function useSortableColumns(hooks) {
|
|
91
92
|
};
|
92
93
|
var Header = function Header(headerProp) {
|
93
94
|
var _cx;
|
94
|
-
return column.disableSortBy === true ? column.Header : /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
95
|
+
return column.disableSortBy === true || column.id === 'datagridSelection' ? column.disableSortBy ? column.Header : /*#__PURE__*/_react.default.createElement(_DatagridSelectAll.SelectAll, instance) : /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
95
96
|
"aria-sort": getAriaSortValue(headerProp === null || headerProp === void 0 ? void 0 : headerProp.column, {
|
96
97
|
ascendingSortableLabelText: ascendingSortableLabelText,
|
97
98
|
descendingSortableLabelText: descendingSortableLabelText,
|
@@ -27,7 +27,9 @@ var FilterSummary = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref)
|
|
27
27
|
_ref$filters = _ref.filters,
|
28
28
|
filters = _ref$filters === void 0 ? [] : _ref$filters,
|
29
29
|
_ref$renderLabel = _ref.renderLabel,
|
30
|
-
renderLabel = _ref$renderLabel === void 0 ? null : _ref$renderLabel
|
30
|
+
renderLabel = _ref$renderLabel === void 0 ? null : _ref$renderLabel,
|
31
|
+
_ref$overflowType = _ref.overflowType,
|
32
|
+
overflowType = _ref$overflowType === void 0 ? 'default' : _ref$overflowType;
|
31
33
|
var tagFilters = filters.map(function (_ref2) {
|
32
34
|
var _renderLabel;
|
33
35
|
var key = _ref2.key,
|
@@ -46,7 +48,8 @@ var FilterSummary = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref)
|
|
46
48
|
allTagsModalSearchPlaceholderText: "Search all tags",
|
47
49
|
allTagsModalTitle: "All tags",
|
48
50
|
showAllTagsLabel: "View all tags",
|
49
|
-
tags: tagFilters
|
51
|
+
tags: tagFilters,
|
52
|
+
overflowType: overflowType
|
50
53
|
}), /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
51
54
|
kind: "ghost",
|
52
55
|
size: "sm",
|
@@ -60,6 +63,7 @@ FilterSummary.propTypes = {
|
|
60
63
|
clearFilters: _propTypes.default.func.isRequired,
|
61
64
|
clearFiltersText: _propTypes.default.string,
|
62
65
|
filters: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
|
66
|
+
overflowType: _propTypes.default.oneOf(['default', 'tag']),
|
63
67
|
renderLabel: _propTypes.default.func
|
64
68
|
};
|
65
69
|
var _default = FilterSummary;
|
@@ -21,7 +21,7 @@ var _useResizeObserver = require("../../global/js/hooks/useResizeObserver");
|
|
21
21
|
var _devtools = require("../../global/js/utils/devtools");
|
22
22
|
var _propsHelper = require("../../global/js/utils/props-helper");
|
23
23
|
var _settings = require("../../settings");
|
24
|
-
var _excluded = ["align", "allTagsModalTarget", "className", "maxVisible", "multiline", "overflowAlign", "overflowClassName", "overflowDirection", "allTagsModalTitle", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "showAllTagsLabel", "tags"],
|
24
|
+
var _excluded = ["align", "allTagsModalTarget", "className", "maxVisible", "multiline", "overflowAlign", "overflowClassName", "overflowType", "overflowDirection", "allTagsModalTitle", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "showAllTagsLabel", "tags"],
|
25
25
|
_excluded2 = ["label", "id"],
|
26
26
|
_excluded3 = ["label"];
|
27
27
|
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,7 +37,8 @@ var defaults = {
|
|
37
37
|
align: 'start',
|
38
38
|
// allTagsModalTarget: document.body,
|
39
39
|
overflowAlign: 'center',
|
40
|
-
overflowDirection: 'bottom'
|
40
|
+
overflowDirection: 'bottom',
|
41
|
+
overflowType: 'default'
|
41
42
|
};
|
42
43
|
var TagSet = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
43
44
|
var _ref$align = _ref.align,
|
@@ -49,6 +50,8 @@ var TagSet = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
49
50
|
_ref$overflowAlign = _ref.overflowAlign,
|
50
51
|
overflowAlign = _ref$overflowAlign === void 0 ? defaults.overflowAlign : _ref$overflowAlign,
|
51
52
|
overflowClassName = _ref.overflowClassName,
|
53
|
+
_ref$overflowType = _ref.overflowType,
|
54
|
+
overflowType = _ref$overflowType === void 0 ? defaults.overflowType : _ref$overflowType,
|
52
55
|
_ref$overflowDirectio = _ref.overflowDirection,
|
53
56
|
overflowDirection = _ref$overflowDirectio === void 0 ? defaults.overflowDirection : _ref$overflowDirectio,
|
54
57
|
allTagsModalTitle = _ref.allTagsModalTitle,
|
@@ -144,13 +147,14 @@ var TagSet = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
144
147
|
onShowAllClick: handleShowAllClick,
|
145
148
|
overflowTags: newOverflowTags,
|
146
149
|
overflowAlign: overflowAlign,
|
150
|
+
overflowType: overflowType,
|
147
151
|
overflowDirection: overflowDirection,
|
148
152
|
showAllTagsLabel: showAllTagsLabel,
|
149
153
|
key: "displayed-tag-overflow",
|
150
154
|
ref: overflowTag
|
151
155
|
}));
|
152
156
|
setDisplayedTags(newDisplayedTags);
|
153
|
-
}, [displayCount, overflowAlign, overflowClassName, overflowDirection, showAllTagsLabel, tags]);
|
157
|
+
}, [displayCount, overflowAlign, overflowType, overflowClassName, overflowDirection, showAllTagsLabel, tags]);
|
154
158
|
var checkFullyVisibleTags = (0, _react.useCallback)(function () {
|
155
159
|
if (multiline) {
|
156
160
|
return setDisplayCount(maxVisible);
|
@@ -305,6 +309,10 @@ TagSet.propTypes = {
|
|
305
309
|
* overflowDirection from the standard tooltip
|
306
310
|
*/
|
307
311
|
overflowDirection: _propTypes.default.oneOf(['top', 'right', 'bottom', 'left']),
|
312
|
+
/**
|
313
|
+
* Type of rendering displayed inside of the tag overflow component
|
314
|
+
*/
|
315
|
+
overflowType: _propTypes.default.oneOf(['default', 'tag']),
|
308
316
|
/**
|
309
317
|
* label for the overflow show all tags link.
|
310
318
|
*
|
@@ -16,7 +16,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
16
16
|
var _carbonComponentsReact = require("carbon-components-react");
|
17
17
|
var _settings = require("../../settings");
|
18
18
|
var _pconsole = require("../../global/js/utils/pconsole");
|
19
|
-
var _excluded = ["allTagsModalSearchThreshold", "className", "onShowAllClick", "overflowAlign", "overflowDirection", "overflowTags", "showAllTagsLabel"];
|
19
|
+
var _excluded = ["allTagsModalSearchThreshold", "className", "onShowAllClick", "overflowAlign", "overflowDirection", "overflowTags", "overflowType", "showAllTagsLabel"];
|
20
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); }
|
21
21
|
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; }
|
22
22
|
var componentName = 'TagSetOverflow';
|
@@ -38,6 +38,7 @@ var TagSetOverflow = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref)
|
|
38
38
|
_ref$overflowDirectio = _ref.overflowDirection,
|
39
39
|
overflowDirection = _ref$overflowDirectio === void 0 ? defaults.overflowDirection : _ref$overflowDirectio,
|
40
40
|
overflowTags = _ref.overflowTags,
|
41
|
+
overflowType = _ref.overflowType,
|
41
42
|
showAllTagsLabel = _ref.showAllTagsLabel,
|
42
43
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
43
44
|
var _useState = (0, _react.useState)(false),
|
@@ -81,12 +82,18 @@ var TagSetOverflow = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref)
|
|
81
82
|
}, overflowTags.filter(function (_, index) {
|
82
83
|
return overflowTags.length > allTagsModalSearchThreshold ? index < allTagsModalSearchThreshold : index <= allTagsModalSearchThreshold;
|
83
84
|
}).map(function (tag, index) {
|
85
|
+
var _cx2;
|
86
|
+
var tagProps = {};
|
87
|
+
if (overflowType === 'tag') {
|
88
|
+
tagProps.type = 'high-contrast';
|
89
|
+
}
|
90
|
+
if (overflowType === 'default') {
|
91
|
+
tagProps.filter = false;
|
92
|
+
}
|
84
93
|
return /*#__PURE__*/_react.default.createElement("li", {
|
85
|
-
className: "".concat(blockClass, "__tag-item"),
|
94
|
+
className: (0, _classnames.default)("".concat(blockClass, "__tag-item"), (_cx2 = {}, (0, _defineProperty2.default)(_cx2, "".concat(blockClass, "__tag-item--default"), overflowType === 'default'), (0, _defineProperty2.default)(_cx2, "".concat(blockClass, "__tag-item--tag"), overflowType === 'tag'), _cx2)),
|
86
95
|
key: index
|
87
|
-
}, /*#__PURE__*/_react.default.cloneElement(tag,
|
88
|
-
filter: false
|
89
|
-
}));
|
96
|
+
}, /*#__PURE__*/_react.default.cloneElement(tag, tagProps));
|
90
97
|
})), overflowTags.length > allTagsModalSearchThreshold && /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Link, {
|
91
98
|
className: "".concat(blockClass, "__show-all-tags-link"),
|
92
99
|
href: "",
|
@@ -121,6 +128,10 @@ TagSetOverflow.propTypes = {
|
|
121
128
|
* tags shown in overflow
|
122
129
|
*/
|
123
130
|
overflowTags: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
|
131
|
+
/**
|
132
|
+
* Type of rendering displayed inside of the tag overflow component
|
133
|
+
*/
|
134
|
+
overflowType: _propTypes.default.oneOf(['default', 'tag']),
|
124
135
|
/**
|
125
136
|
* label for the overflow show all tags link
|
126
137
|
*/
|
@@ -0,0 +1,59 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
exports.getNodeTextContent = void 0;
|
8
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
9
|
+
/**
|
10
|
+
* Copyright IBM Corp. 2023, 2023
|
11
|
+
*
|
12
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
13
|
+
* LICENSE file in the root directory of this source tree.
|
14
|
+
*/
|
15
|
+
|
16
|
+
/**
|
17
|
+
* Returns a compiled string of all the text content of a React node and any of its child nodes.
|
18
|
+
* This is meant to be used in a limited fashion to convert a "styled" sentence into a single string:
|
19
|
+
* e.g. <p>Title <b>Page</b>.</p> --> "Title Page."
|
20
|
+
* This will likely not work for arrays of nodes due to the lack of word spacing:
|
21
|
+
* e.g. <ul>
|
22
|
+
* <li>Item 1</li>
|
23
|
+
* <li>Item 2</li>
|
24
|
+
* <li>Item 3</li>
|
25
|
+
* </ul>
|
26
|
+
* --> "Item 1Item 2Item 3"
|
27
|
+
* @param {Node} node A React node
|
28
|
+
* @returns {string}
|
29
|
+
*/
|
30
|
+
var getNodeTextContent = function getNodeTextContent(node) {
|
31
|
+
if (node == null) {
|
32
|
+
return '';
|
33
|
+
}
|
34
|
+
switch ((0, _typeof2.default)(node)) {
|
35
|
+
case 'string':
|
36
|
+
case 'number':
|
37
|
+
return node.toString();
|
38
|
+
case 'object':
|
39
|
+
{
|
40
|
+
if (node instanceof Array) {
|
41
|
+
return node.map(getNodeTextContent).join('');
|
42
|
+
}
|
43
|
+
if ('props' in node) {
|
44
|
+
return getNodeTextContent(node.props.children);
|
45
|
+
}
|
46
|
+
|
47
|
+
// Ignore any other JavaScript 'object' types.
|
48
|
+
return '';
|
49
|
+
}
|
50
|
+
case 'function':
|
51
|
+
{
|
52
|
+
return getNodeTextContent(node());
|
53
|
+
}
|
54
|
+
default:
|
55
|
+
// Ignore all other JavaScript types.
|
56
|
+
return '';
|
57
|
+
}
|
58
|
+
};
|
59
|
+
exports.getNodeTextContent = getNodeTextContent;
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@carbon/ibm-products",
|
3
3
|
"description": "Carbon for IBM Products",
|
4
|
-
"version": "1.
|
4
|
+
"version": "1.61.0",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"main": "lib/index.js",
|
7
7
|
"module": "es/index.js",
|
@@ -91,11 +91,11 @@
|
|
91
91
|
"@carbon/motion": "^10.29.2",
|
92
92
|
"@carbon/themes": "^10.55.3",
|
93
93
|
"@carbon/type": "^10.45.3",
|
94
|
-
"carbon-components": "^10.58.
|
95
|
-
"carbon-components-react": "^7.59.
|
94
|
+
"carbon-components": "^10.58.12",
|
95
|
+
"carbon-components-react": "^7.59.16",
|
96
96
|
"carbon-icons": "^7.0.7",
|
97
97
|
"react": "^16.8.6 || ^17.0.1",
|
98
98
|
"react-dom": "^16.8.6 || ^17.0.1"
|
99
99
|
},
|
100
|
-
"gitHead": "
|
100
|
+
"gitHead": "3c7061f7f7907eeeddbbd25f723bb87e867a0073"
|
101
101
|
}
|
@@ -19,6 +19,7 @@
|
|
19
19
|
|
20
20
|
// Datagrid uses the following Carbon for IBM Products components:
|
21
21
|
// TODO: @import(s) of IBM Products component styles used by Datagrid
|
22
|
+
@import '../FilterSummary/filter-summary';
|
22
23
|
|
23
24
|
// Define all component styles in a mixin which is then exported using
|
24
25
|
// the Carbon import-once mechanism.
|
@@ -108,18 +108,14 @@ $row-heights: (
|
|
108
108
|
justify-content: flex-start;
|
109
109
|
}
|
110
110
|
// Always show renderIcon if inline edit columns are less than half of total columns
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
.#{$block-class}__inline-edit-button-icon {
|
115
|
-
display: none;
|
116
|
-
}
|
111
|
+
.#{$block-class}__inline-edit-button-icon {
|
112
|
+
display: none;
|
113
|
+
}
|
117
114
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
}
|
115
|
+
&:hover,
|
116
|
+
&.#{$block-class}__inline-edit-button--active {
|
117
|
+
.#{$block-class}__inline-edit-button-icon {
|
118
|
+
display: block;
|
123
119
|
}
|
124
120
|
}
|
125
121
|
}
|
@@ -22,7 +22,48 @@
|
|
22
22
|
}
|
23
23
|
|
24
24
|
.#{$carbon-prefix}--btn--ghost.#{$block-class}__row-size-button--open {
|
25
|
-
background-color: $ui-
|
25
|
+
background-color: $ui-02;
|
26
26
|
|
27
27
|
box-shadow: 1px 4px 8px -3px $overlay-01, -1px 6px 8px -5px $overlay-01;
|
28
28
|
}
|
29
|
+
|
30
|
+
// Top align cell content for xl row size
|
31
|
+
.#{$block-class}
|
32
|
+
table.#{$carbon-prefix}--data-table--xl.#{$block-class}__vertical-align-center
|
33
|
+
td,
|
34
|
+
.#{$block-class}
|
35
|
+
table.#{$carbon-prefix}--data-table--xl.#{$block-class}__vertical-align-top
|
36
|
+
td {
|
37
|
+
align-items: flex-start;
|
38
|
+
padding-top: $spacing-05;
|
39
|
+
padding-bottom: $spacing-05;
|
40
|
+
|
41
|
+
&.#{$block-class}__actions-column-cell {
|
42
|
+
padding-left: $spacing-03;
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
// Top align header content for xl row size
|
47
|
+
.#{$block-class}
|
48
|
+
table.#{$carbon-prefix}--data-table--xl.#{$block-class}__vertical-align-center
|
49
|
+
th,
|
50
|
+
.#{$block-class}
|
51
|
+
table.#{$carbon-prefix}--data-table--xl.#{$block-class}__vertical-align-top
|
52
|
+
th {
|
53
|
+
.#{$carbon-prefix}--table-header-label {
|
54
|
+
align-items: flex-start;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
// Top align checkbox row header for xl row size
|
59
|
+
.#{$block-class}
|
60
|
+
table.#{$carbon-prefix}--data-table--xl.#{$block-class}__vertical-align-center
|
61
|
+
.#{$block-class}__checkbox-cell
|
62
|
+
th.#{$carbon-prefix}--table-column-checkbox {
|
63
|
+
align-items: flex-start;
|
64
|
+
padding-top: $spacing-04;
|
65
|
+
}
|
66
|
+
|
67
|
+
.#{$block-class}__row-size__row-settings-trigger--open.#{$carbon-prefix}--btn--ghost {
|
68
|
+
background-color: $ui-02;
|
69
|
+
}
|
@@ -70,7 +70,7 @@ $block-class-modal: #{$block-class}-modal;
|
|
70
70
|
}
|
71
71
|
|
72
72
|
.#{$block-class-overflow}__tooltip
|
73
|
-
.#{$block-class-overflow}__tag-item
|
73
|
+
.#{$block-class-overflow}__tag-item--default
|
74
74
|
.#{$carbon-prefix}--tag {
|
75
75
|
border-radius: 0;
|
76
76
|
}
|
@@ -127,13 +127,23 @@ $block-class-modal: #{$block-class}-modal;
|
|
127
127
|
text-align: left;
|
128
128
|
}
|
129
129
|
|
130
|
+
&.#{$carbon-prefix}--tooltip button {
|
131
|
+
padding-right: 0;
|
132
|
+
}
|
133
|
+
|
130
134
|
.#{$block-class-overflow}__show-all-tags-link {
|
131
135
|
display: inline-block;
|
132
136
|
margin: $spacing-03 0 $spacing-02; // to match the tags
|
133
137
|
}
|
134
138
|
|
135
|
-
.#{$block-class-overflow}__tag-item
|
136
|
-
|
139
|
+
.#{$block-class-overflow}__tag-item.#{$block-class-overflow}__tag-item--tag
|
140
|
+
.#{$carbon-prefix}--tag {
|
141
|
+
background-color: $inverse-hover-ui;
|
142
|
+
}
|
143
|
+
|
144
|
+
.#{$block-class-overflow}__tag-item.#{$block-class-overflow}__tag-item--default,
|
145
|
+
.#{$block-class-overflow}__tag-item.#{$block-class-overflow}__tag-item--default
|
146
|
+
.#{$carbon-prefix}--tag {
|
137
147
|
@include carbon--type-style('body-short-01');
|
138
148
|
|
139
149
|
display: block;
|
@@ -1,25 +0,0 @@
|
|
1
|
-
// This function recursively looks for the nested header element until we can find the key which contains the title.
|
2
|
-
// This can happen if multiple hooks are used together that manipulate the rendering of the column
|
3
|
-
// header, such as `useColumnCenterAlign` and `useSortableColumns`.
|
4
|
-
var getNestedTitle = function getNestedTitle(component) {
|
5
|
-
if (component && !component.key) {
|
6
|
-
return getNestedTitle(component.children);
|
7
|
-
}
|
8
|
-
if (component && component.key && typeof component.key === 'string') {
|
9
|
-
return component.key;
|
10
|
-
}
|
11
|
-
};
|
12
|
-
var getColTitle = function getColTitle(col) {
|
13
|
-
var _col$Header, _col$Header$props;
|
14
|
-
if (!col) {
|
15
|
-
return;
|
16
|
-
}
|
17
|
-
var checkTitle = function checkTitle() {
|
18
|
-
if (col.Header().props.children.props && col.Header().props.children.props.title) {
|
19
|
-
return col.Header().props.children.props.title;
|
20
|
-
}
|
21
|
-
return getNestedTitle(col.Header().props.children.props);
|
22
|
-
};
|
23
|
-
return typeof (col === null || col === void 0 ? void 0 : col.Header) === 'function' ? checkTitle() : col === null || col === void 0 ? void 0 : (_col$Header = col.Header) === null || _col$Header === void 0 ? void 0 : (_col$Header$props = _col$Header.props) === null || _col$Header$props === void 0 ? void 0 : _col$Header$props.title;
|
24
|
-
};
|
25
|
-
export default getColTitle;
|
@@ -1,32 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.default = void 0;
|
7
|
-
// This function recursively looks for the nested header element until we can find the key which contains the title.
|
8
|
-
// This can happen if multiple hooks are used together that manipulate the rendering of the column
|
9
|
-
// header, such as `useColumnCenterAlign` and `useSortableColumns`.
|
10
|
-
var getNestedTitle = function getNestedTitle(component) {
|
11
|
-
if (component && !component.key) {
|
12
|
-
return getNestedTitle(component.children);
|
13
|
-
}
|
14
|
-
if (component && component.key && typeof component.key === 'string') {
|
15
|
-
return component.key;
|
16
|
-
}
|
17
|
-
};
|
18
|
-
var getColTitle = function getColTitle(col) {
|
19
|
-
var _col$Header, _col$Header$props;
|
20
|
-
if (!col) {
|
21
|
-
return;
|
22
|
-
}
|
23
|
-
var checkTitle = function checkTitle() {
|
24
|
-
if (col.Header().props.children.props && col.Header().props.children.props.title) {
|
25
|
-
return col.Header().props.children.props.title;
|
26
|
-
}
|
27
|
-
return getNestedTitle(col.Header().props.children.props);
|
28
|
-
};
|
29
|
-
return typeof (col === null || col === void 0 ? void 0 : col.Header) === 'function' ? checkTitle() : col === null || col === void 0 ? void 0 : (_col$Header = col.Header) === null || _col$Header === void 0 ? void 0 : (_col$Header$props = _col$Header.props) === null || _col$Header$props === void 0 ? void 0 : _col$Header$props.title;
|
30
|
-
};
|
31
|
-
var _default = getColTitle;
|
32
|
-
exports.default = _default;
|