@datarobot/design-system 30.1.0 → 30.1.1
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.
|
@@ -19,17 +19,18 @@ const TruncatedBreadcrumbs = ({
|
|
|
19
19
|
showItemsInBreadcrumbs
|
|
20
20
|
}) => {
|
|
21
21
|
const firstItem = crumbs[0];
|
|
22
|
-
const
|
|
23
|
-
const
|
|
22
|
+
const lastItemsCount = showItemsInBreadcrumbs - 1;
|
|
23
|
+
const middleSetOfCrumbs = crumbs.slice(1, crumbs.length - lastItemsCount);
|
|
24
|
+
const lastCrumbs = lastItemsCount > 0 ? crumbs.slice(-lastItemsCount) : [];
|
|
24
25
|
const indexOfCrumb = crumb => crumbs.indexOf(crumb);
|
|
25
26
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
26
27
|
children: [/*#__PURE__*/(0, _react.createElement)(_breadcrumbsItem.BreadcrumbsItem, {
|
|
27
|
-
...
|
|
28
|
+
...firstItem,
|
|
28
29
|
key: indexOfCrumb(firstItem),
|
|
29
30
|
index: indexOfCrumb(firstItem),
|
|
30
31
|
shouldRenderIconBack: shouldRenderIconBack,
|
|
31
32
|
LinkComponent: LinkComponent
|
|
32
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
33
|
+
}), middleSetOfCrumbs.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
33
34
|
className: "breadcrumbs breadcrumb-item",
|
|
34
35
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_dropdownMenu.DropdownMenu, {
|
|
35
36
|
contentTestId: "truncated-breadcrumbs",
|
|
@@ -53,7 +54,15 @@ const TruncatedBreadcrumbs = ({
|
|
|
53
54
|
onSelect: ({
|
|
54
55
|
key
|
|
55
56
|
}) => {
|
|
56
|
-
const
|
|
57
|
+
const selectedCrumb = crumbs[Number(key)];
|
|
58
|
+
if (typeof selectedCrumb.click === 'function') {
|
|
59
|
+
selectedCrumb.click({
|
|
60
|
+
preventDefault: () => {},
|
|
61
|
+
stopPropagation: () => {}
|
|
62
|
+
});
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const link = selectedCrumb.link;
|
|
57
66
|
if (link) {
|
|
58
67
|
window.location.href = link;
|
|
59
68
|
}
|
|
@@ -12,17 +12,18 @@ export const TruncatedBreadcrumbs = ({
|
|
|
12
12
|
showItemsInBreadcrumbs
|
|
13
13
|
}) => {
|
|
14
14
|
const firstItem = crumbs[0];
|
|
15
|
-
const
|
|
16
|
-
const
|
|
15
|
+
const lastItemsCount = showItemsInBreadcrumbs - 1;
|
|
16
|
+
const middleSetOfCrumbs = crumbs.slice(1, crumbs.length - lastItemsCount);
|
|
17
|
+
const lastCrumbs = lastItemsCount > 0 ? crumbs.slice(-lastItemsCount) : [];
|
|
17
18
|
const indexOfCrumb = crumb => crumbs.indexOf(crumb);
|
|
18
19
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
19
20
|
children: [/*#__PURE__*/_createElement(BreadcrumbsItem, {
|
|
20
|
-
...
|
|
21
|
+
...firstItem,
|
|
21
22
|
key: indexOfCrumb(firstItem),
|
|
22
23
|
index: indexOfCrumb(firstItem),
|
|
23
24
|
shouldRenderIconBack: shouldRenderIconBack,
|
|
24
25
|
LinkComponent: LinkComponent
|
|
25
|
-
}), /*#__PURE__*/_jsx("li", {
|
|
26
|
+
}), middleSetOfCrumbs.length > 0 && /*#__PURE__*/_jsx("li", {
|
|
26
27
|
className: "breadcrumbs breadcrumb-item",
|
|
27
28
|
children: /*#__PURE__*/_jsx(DropdownMenu, {
|
|
28
29
|
contentTestId: "truncated-breadcrumbs",
|
|
@@ -46,7 +47,15 @@ export const TruncatedBreadcrumbs = ({
|
|
|
46
47
|
onSelect: ({
|
|
47
48
|
key
|
|
48
49
|
}) => {
|
|
49
|
-
const
|
|
50
|
+
const selectedCrumb = crumbs[Number(key)];
|
|
51
|
+
if (typeof selectedCrumb.click === 'function') {
|
|
52
|
+
selectedCrumb.click({
|
|
53
|
+
preventDefault: () => {},
|
|
54
|
+
stopPropagation: () => {}
|
|
55
|
+
});
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const link = selectedCrumb.link;
|
|
50
59
|
if (link) {
|
|
51
60
|
window.location.href = link;
|
|
52
61
|
}
|
package/js/bundle/bundle.js
CHANGED
|
@@ -44949,17 +44949,18 @@ var TruncatedBreadcrumbs = function TruncatedBreadcrumbs(_ref) {
|
|
|
44949
44949
|
LinkComponent = _ref$LinkComponent === void 0 ? _breadcrumb_link_component__WEBPACK_IMPORTED_MODULE_2__.BreadcrumbLinkComponent : _ref$LinkComponent,
|
|
44950
44950
|
showItemsInBreadcrumbs = _ref.showItemsInBreadcrumbs;
|
|
44951
44951
|
var firstItem = crumbs[0];
|
|
44952
|
-
var
|
|
44953
|
-
var
|
|
44952
|
+
var lastItemsCount = showItemsInBreadcrumbs - 1;
|
|
44953
|
+
var middleSetOfCrumbs = crumbs.slice(1, crumbs.length - lastItemsCount);
|
|
44954
|
+
var lastCrumbs = lastItemsCount > 0 ? crumbs.slice(-lastItemsCount) : [];
|
|
44954
44955
|
var indexOfCrumb = function indexOfCrumb(crumb) {
|
|
44955
44956
|
return crumbs.indexOf(crumb);
|
|
44956
44957
|
};
|
|
44957
|
-
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_breadcrumbs_item__WEBPACK_IMPORTED_MODULE_3__.BreadcrumbsItem, _extends({},
|
|
44958
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_breadcrumbs_item__WEBPACK_IMPORTED_MODULE_3__.BreadcrumbsItem, _extends({}, firstItem, {
|
|
44958
44959
|
key: indexOfCrumb(firstItem),
|
|
44959
44960
|
index: indexOfCrumb(firstItem),
|
|
44960
44961
|
shouldRenderIconBack: shouldRenderIconBack,
|
|
44961
44962
|
LinkComponent: LinkComponent
|
|
44962
|
-
})), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("li", {
|
|
44963
|
+
})), middleSetOfCrumbs.length > 0 && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("li", {
|
|
44963
44964
|
className: "breadcrumbs breadcrumb-item"
|
|
44964
44965
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(_dropdown_menu__WEBPACK_IMPORTED_MODULE_4__.DropdownMenu, {
|
|
44965
44966
|
contentTestId: "truncated-breadcrumbs",
|
|
@@ -44984,7 +44985,15 @@ var TruncatedBreadcrumbs = function TruncatedBreadcrumbs(_ref) {
|
|
|
44984
44985
|
}),
|
|
44985
44986
|
onSelect: function onSelect(_ref2) {
|
|
44986
44987
|
var key = _ref2.key;
|
|
44987
|
-
var
|
|
44988
|
+
var selectedCrumb = crumbs[Number(key)];
|
|
44989
|
+
if (typeof selectedCrumb.click === 'function') {
|
|
44990
|
+
selectedCrumb.click({
|
|
44991
|
+
preventDefault: function preventDefault() {},
|
|
44992
|
+
stopPropagation: function stopPropagation() {}
|
|
44993
|
+
});
|
|
44994
|
+
return;
|
|
44995
|
+
}
|
|
44996
|
+
var link = selectedCrumb.link;
|
|
44988
44997
|
if (link) {
|
|
44989
44998
|
window.location.href = link;
|
|
44990
44999
|
}
|