@eccenca/gui-elements 23.0.0-rc.3-unofficial.0 → 23.0.0-rc.3
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/CHANGELOG.md +4 -1
- package/dist/cjs/components/Breadcrumb/BreadcrumbItem.js +13 -4
- package/dist/cjs/components/Breadcrumb/BreadcrumbItem.js.map +1 -1
- package/dist/cjs/components/Breadcrumb/BreadcrumbList.js +11 -4
- package/dist/cjs/components/Breadcrumb/BreadcrumbList.js.map +1 -1
- package/dist/esm/components/Breadcrumb/BreadcrumbItem.js +13 -4
- package/dist/esm/components/Breadcrumb/BreadcrumbItem.js.map +1 -1
- package/dist/esm/components/Breadcrumb/BreadcrumbList.js +11 -4
- package/dist/esm/components/Breadcrumb/BreadcrumbList.js.map +1 -1
- package/dist/types/components/Breadcrumb/BreadcrumbItem.d.ts +7 -3
- package/dist/types/components/Breadcrumb/BreadcrumbList.d.ts +20 -8
- package/package.json +10 -10
- package/src/components/Breadcrumb/BreadcrumbItem.tsx +15 -6
- package/src/components/Breadcrumb/BreadcrumbList.tsx +36 -14
- package/src/components/Breadcrumb/breadcrumb.scss +24 -1
- package/src/components/Breadcrumb/stories/BreadcrumbItem.stories.tsx +19 -0
- package/src/components/Breadcrumb/stories/BreadcrumbList.stories.tsx +26 -0
package/CHANGELOG.md
CHANGED
|
@@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
|
|
16
16
|
* `EdgeDefault.data.renderLabel` function allows to render fully custom edge label including any ReactNode
|
|
17
17
|
* `StickyNoteNode`, usable by `stickynote` type in react flow editors for workflows and linking rules
|
|
18
18
|
* add option for `footerContent` to react flow node data
|
|
19
|
+
* `<BreadcrumbList />`: new properties `ignoreOverflow` and `latenOverflow`, that can be used to implement a second overflow strategy beside BlueprintJS overflow list, for example in case the overflow list leads to re-rendering loops
|
|
19
20
|
|
|
20
21
|
### Fixed
|
|
21
22
|
|
|
@@ -29,7 +30,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
|
|
29
30
|
* move style imports of CodeMirror layout to `extensions`
|
|
30
31
|
* color configurations for react flow editor are not exported as modules anymore, they need to be fetched by `getColorConfiguration` method in JS directly
|
|
31
32
|
* BlueprintJS was upgraded to a recent v4
|
|
32
|
-
* elements were also upgraded to usage of `Popover2`, `Tooltip2`, `Select2` and `
|
|
33
|
+
* elements were also upgraded to usage of `Popover2`, `Tooltip2`, `Select2`, `MultiSelect2` and `Breadcrumbs2`
|
|
33
34
|
* this comes also with a necessary switch from `node-sass` to `sass` package, a javascript port from the original dart sass library, see migration notes to update your build process
|
|
34
35
|
|
|
35
36
|
### Migration notes
|
|
@@ -46,6 +47,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
|
|
|
46
47
|
* `<MultiSelect>`: `popoverProps` was renamed to `contextOverlayProps`
|
|
47
48
|
* `<Select>`: `popoverProps` was renamed to `contextOverlayProps`
|
|
48
49
|
* `<Tooltip>`: this element now extends directly the Blueprint element, so `tolltipProps` was removed, use properties directly on `Tooltip`
|
|
50
|
+
* `<BreadcrumbItem>`: `IBreadcrumbItemProps` interface was renamed to `BreadcrumbItemProps`
|
|
51
|
+
* `BreadcrumbList`: `IBreadcrumbListProps` interface was renamed to `BreadcrumbListProps`
|
|
49
52
|
|
|
50
53
|
#### Switch from `node-sass` to `sass`
|
|
51
54
|
|
|
@@ -19,10 +19,11 @@ const react_1 = __importDefault(require("react"));
|
|
|
19
19
|
const core_1 = require("@blueprintjs/core");
|
|
20
20
|
const constants_1 = require("../../configuration/constants");
|
|
21
21
|
const openInNewTab_1 = require("../../common/utils/openInNewTab");
|
|
22
|
+
/**
|
|
23
|
+
* Item of the breadcrumbs list.
|
|
24
|
+
* It cannot be used directly but the properties can be used within the elements of the `BreadcrumbList.items` property.
|
|
25
|
+
*/
|
|
22
26
|
function BreadcrumbItem(_a) {
|
|
23
|
-
var { className = "", onClick, href } = _a,
|
|
24
|
-
//itemDivider='',
|
|
25
|
-
otherBlueprintBreadcrumbProps = __rest(_a, ["className", "onClick", "href"]);
|
|
26
27
|
/*
|
|
27
28
|
FIXME: adding `data-divider` does not work this way because BlueprintJS
|
|
28
29
|
breadcrumb component does not support (and forward) it on HTML element
|
|
@@ -30,7 +31,15 @@ function BreadcrumbItem(_a) {
|
|
|
30
31
|
CSS/Sass as content for the pseudo element, currently done static in CSS
|
|
31
32
|
with slash char.
|
|
32
33
|
*/
|
|
33
|
-
|
|
34
|
+
var { className = "", onClick, href } = _a,
|
|
35
|
+
//itemDivider='',
|
|
36
|
+
otherBlueprintBreadcrumbProps = __rest(_a, ["className", "onClick", "href"]);
|
|
37
|
+
const allowActions = !otherBlueprintBreadcrumbProps.current && !otherBlueprintBreadcrumbProps.disabled;
|
|
38
|
+
const actions = allowActions ? {
|
|
39
|
+
href,
|
|
40
|
+
onClick: (e) => (0, openInNewTab_1.openInNewTab)(e, onClick, href),
|
|
41
|
+
} : {};
|
|
42
|
+
return (react_1.default.createElement(core_1.Breadcrumb, Object.assign({}, otherBlueprintBreadcrumbProps, actions, { className: `${constants_1.CLASSPREFIX}-breadcrumb__item ` + className })));
|
|
34
43
|
}
|
|
35
44
|
exports.default = BreadcrumbItem;
|
|
36
45
|
//# sourceMappingURL=BreadcrumbItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BreadcrumbItem.js","sourceRoot":"","sources":["../../../../src/components/Breadcrumb/BreadcrumbItem.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,sCAAsC;AACtC,4CAG2B;AAC3B,6DAAsE;AACtE,kEAA+D;AAY/D,SAAS,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"BreadcrumbItem.js","sourceRoot":"","sources":["../../../../src/components/Breadcrumb/BreadcrumbItem.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,sCAAsC;AACtC,4CAG2B;AAC3B,6DAAsE;AACtE,kEAA+D;AAY/D;;;GAGG;AACH,SAAS,cAAc,CAAC,EAMF;IAElB;;;;;;MAME;QAdkB,EACpB,SAAS,GAAG,EAAE,EACd,OAAO,EACP,IAAI,OAGc;IAFlB,iBAAiB;IACd,6BAA6B,cALZ,gCAMvB,CADmC;IAWhC,MAAM,YAAY,GAAG,CAAC,6BAA6B,CAAC,OAAO,IAAI,CAAC,6BAA6B,CAAC,QAAQ,CAAC;IACvG,MAAM,OAAO,GAAG,YAAY,CAAC,CAAC,CAAC;QAC3B,IAAI;QACJ,OAAO,EAAE,CAAC,CAA+B,EAAE,EAAE,CAAC,IAAA,2BAAY,EAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC;KAC/E,CAAC,CAAC,CAAC,EAAE,CAAC;IACP,OAAO,CACL,8BAAC,iBAAuB,oBAClB,6BAA6B,EAC7B,OAAO,IACX,SAAS,EAAE,GAAG,uBAAM,oBAAoB,GAAG,SAAS,IAEpD,CACH,CAAC;AACN,CAAC;AAED,kBAAe,cAAc,CAAC"}
|
|
@@ -15,13 +15,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
const react_1 = __importDefault(require("react"));
|
|
18
|
-
const
|
|
18
|
+
const popover2_1 = require("@blueprintjs/popover2");
|
|
19
19
|
const constants_1 = require("../../configuration/constants");
|
|
20
20
|
const BreadcrumbItem_1 = __importDefault(require("./BreadcrumbItem"));
|
|
21
|
+
/**
|
|
22
|
+
* Navigation path to the currently show resource or view in the application.
|
|
23
|
+
*/
|
|
21
24
|
function BreadcrumbList(_a) {
|
|
22
25
|
var { className = "",
|
|
23
26
|
// itemDivider = "/",
|
|
24
|
-
onItemClick, htmlUlProps } = _a, otherBlueprintBreadcrumbsProps = __rest(_a, ["className", "onItemClick", "htmlUlProps"]);
|
|
27
|
+
onItemClick, htmlUlProps, ignoreOverflow = false, latenOverflow = false } = _a, otherBlueprintBreadcrumbsProps = __rest(_a, ["className", "onItemClick", "htmlUlProps", "ignoreOverflow", "latenOverflow"]);
|
|
25
28
|
const renderBreadcrumb = (propsBreadcrumb) => {
|
|
26
29
|
const { onClick } = propsBreadcrumb, otherProps = __rest(propsBreadcrumb, ["onClick"]);
|
|
27
30
|
return (react_1.default.createElement(BreadcrumbItem_1.default
|
|
@@ -33,9 +36,13 @@ function BreadcrumbList(_a) {
|
|
|
33
36
|
: onClick })));
|
|
34
37
|
};
|
|
35
38
|
const renderCurrentBreadcrumb = (propsBreadcrumb) => {
|
|
36
|
-
return react_1.default.createElement(BreadcrumbItem_1.default, Object.assign({}, propsBreadcrumb, { current: true
|
|
39
|
+
return react_1.default.createElement(BreadcrumbItem_1.default, Object.assign({}, propsBreadcrumb, { current: true }));
|
|
37
40
|
};
|
|
38
|
-
return (react_1.default.createElement(
|
|
41
|
+
return (react_1.default.createElement(popover2_1.Breadcrumbs2, Object.assign({}, otherBlueprintBreadcrumbsProps, htmlUlProps, { className: `${constants_1.CLASSPREFIX}-breadcrumb__list` +
|
|
42
|
+
(latenOverflow ? ` ${constants_1.CLASSPREFIX}-breadcrumb__list--latenoverflow` : "") +
|
|
43
|
+
(className ? ` ${className}` : ""), minVisibleItems: 1, breadcrumbRenderer: renderBreadcrumb, currentBreadcrumbRenderer: renderCurrentBreadcrumb, overflowListProps: ignoreOverflow ? {
|
|
44
|
+
minVisibleItems: otherBlueprintBreadcrumbsProps.items.length,
|
|
45
|
+
} : {} })));
|
|
39
46
|
}
|
|
40
47
|
exports.default = BreadcrumbList;
|
|
41
48
|
//# sourceMappingURL=BreadcrumbList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BreadcrumbList.js","sourceRoot":"","sources":["../../../../src/components/Breadcrumb/BreadcrumbList.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAA0B;AAC1B,
|
|
1
|
+
{"version":3,"file":"BreadcrumbList.js","sourceRoot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AClD,iBAAiB,EAAE,cAAc,CAAC,CAAC,CAAC;YAChC,eAAe,EAAE,8BAA8B,CAAC,KAAK,CAAC,MAAM;SAC/D,CAAC,CAAC,CAAC,EAAE,IACR,CACL,CAAC;AACN,CAAC;AAED,kBAAe,cAAc,CAAC"}
|
|
@@ -25,10 +25,11 @@ import React from "react";
|
|
|
25
25
|
import { Breadcrumb as BlueprintBreadcrumbItem, } from "@blueprintjs/core";
|
|
26
26
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants.js";
|
|
27
27
|
import { openInNewTab } from "../../common/utils/openInNewTab.js";
|
|
28
|
+
/**
|
|
29
|
+
* Item of the breadcrumbs list.
|
|
30
|
+
* It cannot be used directly but the properties can be used within the elements of the `BreadcrumbList.items` property.
|
|
31
|
+
*/
|
|
28
32
|
function BreadcrumbItem(_a) {
|
|
29
|
-
var _b = _a.className, className = _b === void 0 ? "" : _b, onClick = _a.onClick, href = _a.href,
|
|
30
|
-
//itemDivider='',
|
|
31
|
-
otherBlueprintBreadcrumbProps = __rest(_a, ["className", "onClick", "href"]);
|
|
32
33
|
/*
|
|
33
34
|
FIXME: adding `data-divider` does not work this way because BlueprintJS
|
|
34
35
|
breadcrumb component does not support (and forward) it on HTML element
|
|
@@ -36,7 +37,15 @@ function BreadcrumbItem(_a) {
|
|
|
36
37
|
CSS/Sass as content for the pseudo element, currently done static in CSS
|
|
37
38
|
with slash char.
|
|
38
39
|
*/
|
|
39
|
-
|
|
40
|
+
var _b = _a.className, className = _b === void 0 ? "" : _b, onClick = _a.onClick, href = _a.href,
|
|
41
|
+
//itemDivider='',
|
|
42
|
+
otherBlueprintBreadcrumbProps = __rest(_a, ["className", "onClick", "href"]);
|
|
43
|
+
var allowActions = !otherBlueprintBreadcrumbProps.current && !otherBlueprintBreadcrumbProps.disabled;
|
|
44
|
+
var actions = allowActions ? {
|
|
45
|
+
href: href,
|
|
46
|
+
onClick: function (e) { return openInNewTab(e, onClick, href); },
|
|
47
|
+
} : {};
|
|
48
|
+
return (React.createElement(BlueprintBreadcrumbItem, __assign({}, otherBlueprintBreadcrumbProps, actions, { className: eccgui + "-breadcrumb__item " + className })));
|
|
40
49
|
}
|
|
41
50
|
export default BreadcrumbItem;
|
|
42
51
|
//# sourceMappingURL=BreadcrumbItem.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BreadcrumbItem.js","sourceRoot":"","sources":["../../../../src/components/Breadcrumb/BreadcrumbItem.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,sCAAsC;AACtC,OAAO,EACH,UAAU,IAAI,uBAAuB,GAExC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,IAAI,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAY/D,SAAS,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"BreadcrumbItem.js","sourceRoot":"","sources":["../../../../src/components/Breadcrumb/BreadcrumbItem.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,sCAAsC;AACtC,OAAO,EACH,UAAU,IAAI,uBAAuB,GAExC,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,WAAW,IAAI,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAY/D;;;GAGG;AACH,SAAS,cAAc,CAAC,EAMF;IAElB;;;;;;MAME;IAbF,IAAA,iBAAc,EAAd,SAAS,mBAAG,EAAE,KAAA,EACd,OAAO,aAAA,EACP,IAAI,UAAA;IACJ,iBAAiB;IACd,6BAA6B,cALZ,gCAMvB,CADmC;IAWhC,IAAM,YAAY,GAAG,CAAC,6BAA6B,CAAC,OAAO,IAAI,CAAC,6BAA6B,CAAC,QAAQ,CAAC;IACvG,IAAM,OAAO,GAAG,YAAY,CAAC,CAAC,CAAC;QAC3B,IAAI,MAAA;QACJ,OAAO,EAAE,UAAC,CAA+B,IAAK,OAAA,YAAY,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,EAA9B,CAA8B;KAC/E,CAAC,CAAC,CAAC,EAAE,CAAC;IACP,OAAO,CACL,oBAAC,uBAAuB,eAClB,6BAA6B,EAC7B,OAAO,IACX,SAAS,EAAK,MAAM,uBAAoB,GAAG,SAAS,IAEpD,CACH,CAAC;AACN,CAAC;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -21,13 +21,16 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import React from "react";
|
|
24
|
-
import {
|
|
24
|
+
import { Breadcrumbs2 as BlueprintBreadcrumbList, } from "@blueprintjs/popover2";
|
|
25
25
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants.js";
|
|
26
26
|
import BreadcrumbItem from "./BreadcrumbItem.js";
|
|
27
|
+
/**
|
|
28
|
+
* Navigation path to the currently show resource or view in the application.
|
|
29
|
+
*/
|
|
27
30
|
function BreadcrumbList(_a) {
|
|
28
31
|
var _b = _a.className, className = _b === void 0 ? "" : _b,
|
|
29
32
|
// itemDivider = "/",
|
|
30
|
-
onItemClick = _a.onItemClick, htmlUlProps = _a.htmlUlProps, otherBlueprintBreadcrumbsProps = __rest(_a, ["className", "onItemClick", "htmlUlProps"]);
|
|
33
|
+
onItemClick = _a.onItemClick, htmlUlProps = _a.htmlUlProps, _c = _a.ignoreOverflow, ignoreOverflow = _c === void 0 ? false : _c, _d = _a.latenOverflow, latenOverflow = _d === void 0 ? false : _d, otherBlueprintBreadcrumbsProps = __rest(_a, ["className", "onItemClick", "htmlUlProps", "ignoreOverflow", "latenOverflow"]);
|
|
31
34
|
var renderBreadcrumb = function (propsBreadcrumb) {
|
|
32
35
|
var onClick = propsBreadcrumb.onClick, otherProps = __rest(propsBreadcrumb, ["onClick"]);
|
|
33
36
|
return (React.createElement(BreadcrumbItem
|
|
@@ -39,9 +42,13 @@ function BreadcrumbList(_a) {
|
|
|
39
42
|
: onClick })));
|
|
40
43
|
};
|
|
41
44
|
var renderCurrentBreadcrumb = function (propsBreadcrumb) {
|
|
42
|
-
return React.createElement(BreadcrumbItem, __assign({}, propsBreadcrumb, { current: true
|
|
45
|
+
return React.createElement(BreadcrumbItem, __assign({}, propsBreadcrumb, { current: true }));
|
|
43
46
|
};
|
|
44
|
-
return (React.createElement(BlueprintBreadcrumbList, __assign({}, otherBlueprintBreadcrumbsProps, htmlUlProps, { className: eccgui + "-breadcrumb__list
|
|
47
|
+
return (React.createElement(BlueprintBreadcrumbList, __assign({}, otherBlueprintBreadcrumbsProps, htmlUlProps, { className: eccgui + "-breadcrumb__list" +
|
|
48
|
+
(latenOverflow ? " " + eccgui + "-breadcrumb__list--latenoverflow" : "") +
|
|
49
|
+
(className ? " " + className : ""), minVisibleItems: 1, breadcrumbRenderer: renderBreadcrumb, currentBreadcrumbRenderer: renderCurrentBreadcrumb, overflowListProps: ignoreOverflow ? {
|
|
50
|
+
minVisibleItems: otherBlueprintBreadcrumbsProps.items.length,
|
|
51
|
+
} : {} })));
|
|
45
52
|
}
|
|
46
53
|
export default BreadcrumbList;
|
|
47
54
|
//# sourceMappingURL=BreadcrumbList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BreadcrumbList.js","sourceRoot":"","sources":["../../../../src/components/Breadcrumb/BreadcrumbList.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACH,
|
|
1
|
+
{"version":3,"file":"BreadcrumbList.js","sourceRoot":"","sources":["../../../../src/components/Breadcrumb/BreadcrumbList.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACH,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AgB,EACpC,yBAAyB,EAAE,uBAAuB,EAClD,iBAAiB,EAAE,cAAc,CAAC,CAAC,CAAC;YAChC,eAAe,EAAE,8BAA8B,CAAC,KAAK,CAAC,MAAM;SAC/D,CAAC,CAAC,CAAC,EAAE,IACR,CACL,CAAC;AACN,CAAC;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
export declare type
|
|
4
|
-
|
|
2
|
+
import { BreadcrumbProps as BlueprintBreadcrumbItemProps } from "@blueprintjs/core";
|
|
3
|
+
export declare type BreadcrumbItemProps = Omit<BlueprintBreadcrumbItemProps, "icon" | "iconTitle" | "intent" | "target">;
|
|
4
|
+
/**
|
|
5
|
+
* Item of the breadcrumbs list.
|
|
6
|
+
* It cannot be used directly but the properties can be used within the elements of the `BreadcrumbList.items` property.
|
|
7
|
+
*/
|
|
8
|
+
declare function BreadcrumbItem({ className, onClick, href, ...otherBlueprintBreadcrumbProps }: BreadcrumbItemProps): JSX.Element;
|
|
5
9
|
export default BreadcrumbItem;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
declare type ReducedBreadcrumbsProps = Omit<
|
|
5
|
-
interface
|
|
2
|
+
import { Breadcrumbs2Props as BlueprintBreadcrumbsProps } from "@blueprintjs/popover2";
|
|
3
|
+
import { BreadcrumbItemProps } from "./BreadcrumbItem";
|
|
4
|
+
declare type ReducedBreadcrumbsProps = Omit<BlueprintBreadcrumbsProps, "breadcrumbRenderer" | "collapseFrom" | "currentBreadcrumbRenderer" | "minVisibleItems" | "overflowListProps" | "popoverProps">;
|
|
5
|
+
interface BreadcrumbListProps extends ReducedBreadcrumbsProps {
|
|
6
6
|
/**
|
|
7
7
|
list of breadcrumb items to display
|
|
8
8
|
*/
|
|
9
|
-
items:
|
|
9
|
+
items: BreadcrumbItemProps[];
|
|
10
10
|
/**
|
|
11
11
|
click handler used on breadcrumb items
|
|
12
12
|
*/
|
|
13
|
-
onItemClick?(itemUrl: string, event: object): any;
|
|
13
|
+
onItemClick?(itemUrl: string | undefined, event: object): any;
|
|
14
14
|
/**
|
|
15
15
|
native attributes for the unordered HTML list (ul)
|
|
16
16
|
*/
|
|
@@ -18,7 +18,19 @@ interface IBreadcrumbListProps extends ReducedBreadcrumbsProps {
|
|
|
18
18
|
/**
|
|
19
19
|
char that devides breadcrumb items, default: "/" (currently unsupported)
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Do not re-render breadcrumbs in a shortened version if they overflow the available space.
|
|
23
|
+
*/
|
|
24
|
+
ignoreOverflow?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* If set to `true` then breadcrumb items can shrink.
|
|
27
|
+
* This way we cannot prevent overflowing breadcrumbs completely but this happens very late.
|
|
28
|
+
* You should enable this when `ignoreOverflow` is `true`.
|
|
29
|
+
*/
|
|
30
|
+
latenOverflow?: boolean;
|
|
22
31
|
}
|
|
23
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Navigation path to the currently show resource or view in the application.
|
|
34
|
+
*/
|
|
35
|
+
declare function BreadcrumbList({ className, onItemClick, htmlUlProps, ignoreOverflow, latenOverflow, ...otherBlueprintBreadcrumbsProps }: BreadcrumbListProps): JSX.Element;
|
|
24
36
|
export default BreadcrumbList;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eccenca/gui-elements",
|
|
3
3
|
"description": "GUI elements based on other libraries, usable in React application, written in Typescript.",
|
|
4
|
-
"version": "23.0.0-rc.3
|
|
4
|
+
"version": "23.0.0-rc.3",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/eccenca/gui-elements",
|
|
7
7
|
"bugs": "https://github.com/eccenca/gui-elements/issues",
|
|
@@ -62,10 +62,10 @@
|
|
|
62
62
|
"check:package": "pjv --warnings --recommendations"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@blueprintjs/colors": "^4.1.
|
|
66
|
-
"@blueprintjs/core": "^4.
|
|
67
|
-
"@blueprintjs/popover2": "^1.
|
|
68
|
-
"@blueprintjs/select": "^4.
|
|
65
|
+
"@blueprintjs/colors": "^4.1.5",
|
|
66
|
+
"@blueprintjs/core": "^4.9.0",
|
|
67
|
+
"@blueprintjs/popover2": "^1.6.0",
|
|
68
|
+
"@blueprintjs/select": "^4.6.0",
|
|
69
69
|
"@carbon/icons": "10.44.0",
|
|
70
70
|
"@carbon/icons-react": "10.44.0",
|
|
71
71
|
"@mavrin/remark-typograf": "^2.2.0",
|
|
@@ -98,12 +98,12 @@
|
|
|
98
98
|
"@babel/preset-flow": "^7.16.5",
|
|
99
99
|
"@babel/preset-react": "^7.16.7",
|
|
100
100
|
"@babel/preset-typescript": "^7.16.7",
|
|
101
|
-
"@storybook/addon-actions": "^6.
|
|
102
|
-
"@storybook/addon-essentials": "^6.
|
|
103
|
-
"@storybook/addon-jest": "^6.
|
|
104
|
-
"@storybook/addon-links": "^6.
|
|
101
|
+
"@storybook/addon-actions": "^6.5.10",
|
|
102
|
+
"@storybook/addon-essentials": "^6.5.10",
|
|
103
|
+
"@storybook/addon-jest": "^6.5.10",
|
|
104
|
+
"@storybook/addon-links": "^6.5.10",
|
|
105
105
|
"@storybook/preset-scss": "^1.0.3",
|
|
106
|
-
"@storybook/react": "^6.
|
|
106
|
+
"@storybook/react": "^6.5.10",
|
|
107
107
|
"@testing-library/jest-dom": "^5.16.1",
|
|
108
108
|
"@testing-library/react": "^12.1.2",
|
|
109
109
|
"@types/carbon-components-react": "7.49.0",
|
|
@@ -2,14 +2,14 @@ import React from "react";
|
|
|
2
2
|
// import PropTypes from 'prop-types';
|
|
3
3
|
import {
|
|
4
4
|
Breadcrumb as BlueprintBreadcrumbItem,
|
|
5
|
-
|
|
5
|
+
BreadcrumbProps as BlueprintBreadcrumbItemProps,
|
|
6
6
|
} from "@blueprintjs/core";
|
|
7
7
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
8
8
|
import { openInNewTab } from "../../common/utils/openInNewTab";
|
|
9
9
|
|
|
10
10
|
// FIXME: enforce href and remove onClick later
|
|
11
|
-
export type
|
|
12
|
-
|
|
11
|
+
export type BreadcrumbItemProps = Omit<
|
|
12
|
+
BlueprintBreadcrumbItemProps,
|
|
13
13
|
// we remove some properties that are currently not necessary, required usage should be discussed
|
|
14
14
|
"icon" |
|
|
15
15
|
"iconTitle" |
|
|
@@ -17,13 +17,17 @@ export type IBreadcrumbItemProps = Omit<
|
|
|
17
17
|
"target"
|
|
18
18
|
>;
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Item of the breadcrumbs list.
|
|
22
|
+
* It cannot be used directly but the properties can be used within the elements of the `BreadcrumbList.items` property.
|
|
23
|
+
*/
|
|
20
24
|
function BreadcrumbItem({
|
|
21
25
|
className = "",
|
|
22
26
|
onClick,
|
|
23
27
|
href,
|
|
24
28
|
//itemDivider='',
|
|
25
29
|
...otherBlueprintBreadcrumbProps
|
|
26
|
-
}:
|
|
30
|
+
}: BreadcrumbItemProps) {
|
|
27
31
|
|
|
28
32
|
/*
|
|
29
33
|
FIXME: adding `data-divider` does not work this way because BlueprintJS
|
|
@@ -32,11 +36,16 @@ function BreadcrumbItem({
|
|
|
32
36
|
CSS/Sass as content for the pseudo element, currently done static in CSS
|
|
33
37
|
with slash char.
|
|
34
38
|
*/
|
|
39
|
+
|
|
40
|
+
const allowActions = !otherBlueprintBreadcrumbProps.current && !otherBlueprintBreadcrumbProps.disabled;
|
|
41
|
+
const actions = allowActions ? {
|
|
42
|
+
href,
|
|
43
|
+
onClick: (e:React.MouseEvent<HTMLElement>) => openInNewTab(e, onClick, href),
|
|
44
|
+
} : {};
|
|
35
45
|
return (
|
|
36
46
|
<BlueprintBreadcrumbItem
|
|
37
47
|
{...otherBlueprintBreadcrumbProps}
|
|
38
|
-
|
|
39
|
-
onClick={(e) => openInNewTab(e, onClick, href)}
|
|
48
|
+
{...actions}
|
|
40
49
|
className={`${eccgui}-breadcrumb__item ` + className}
|
|
41
50
|
/* data-divider={itemDivider ? itemDivider : ''} */
|
|
42
51
|
/>
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "@blueprintjs/
|
|
3
|
+
Breadcrumbs2 as BlueprintBreadcrumbList,
|
|
4
|
+
Breadcrumbs2Props as BlueprintBreadcrumbsProps,
|
|
5
|
+
} from "@blueprintjs/popover2";
|
|
6
6
|
import { CLASSPREFIX as eccgui } from "../../configuration/constants";
|
|
7
7
|
import BreadcrumbItem from "./BreadcrumbItem";
|
|
8
|
-
import {
|
|
8
|
+
import { BreadcrumbItemProps } from "./BreadcrumbItem";
|
|
9
9
|
|
|
10
10
|
type ReducedBreadcrumbsProps = Omit<
|
|
11
|
-
|
|
11
|
+
BlueprintBreadcrumbsProps,
|
|
12
12
|
// we remove some properties that are currently not necessary, required usage should be discussed
|
|
13
13
|
"breadcrumbRenderer" |
|
|
14
14
|
"collapseFrom" |
|
|
@@ -19,15 +19,15 @@ type ReducedBreadcrumbsProps = Omit<
|
|
|
19
19
|
>;
|
|
20
20
|
|
|
21
21
|
// FIXME: enforce onItemClick later when href value can always be routed correctly
|
|
22
|
-
interface
|
|
22
|
+
interface BreadcrumbListProps extends ReducedBreadcrumbsProps {
|
|
23
23
|
/**
|
|
24
24
|
list of breadcrumb items to display
|
|
25
25
|
*/
|
|
26
|
-
items:
|
|
26
|
+
items: BreadcrumbItemProps[];
|
|
27
27
|
/**
|
|
28
28
|
click handler used on breadcrumb items
|
|
29
29
|
*/
|
|
30
|
-
onItemClick?(itemUrl: string, event: object): any;
|
|
30
|
+
onItemClick?(itemUrl: string | undefined, event: object): any;
|
|
31
31
|
/**
|
|
32
32
|
native attributes for the unordered HTML list (ul)
|
|
33
33
|
*/
|
|
@@ -35,17 +35,32 @@ interface IBreadcrumbListProps extends ReducedBreadcrumbsProps {
|
|
|
35
35
|
/**
|
|
36
36
|
char that devides breadcrumb items, default: "/" (currently unsupported)
|
|
37
37
|
*/
|
|
38
|
-
itemDivider?: never;
|
|
38
|
+
//itemDivider?: never;
|
|
39
|
+
/**
|
|
40
|
+
* Do not re-render breadcrumbs in a shortened version if they overflow the available space.
|
|
41
|
+
*/
|
|
42
|
+
ignoreOverflow?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* If set to `true` then breadcrumb items can shrink.
|
|
45
|
+
* This way we cannot prevent overflowing breadcrumbs completely but this happens very late.
|
|
46
|
+
* You should enable this when `ignoreOverflow` is `true`.
|
|
47
|
+
*/
|
|
48
|
+
latenOverflow?: boolean;
|
|
39
49
|
}
|
|
40
50
|
|
|
51
|
+
/**
|
|
52
|
+
* Navigation path to the currently show resource or view in the application.
|
|
53
|
+
*/
|
|
41
54
|
function BreadcrumbList({
|
|
42
55
|
className = "",
|
|
43
56
|
// itemDivider = "/",
|
|
44
57
|
onItemClick,
|
|
45
58
|
htmlUlProps,
|
|
59
|
+
ignoreOverflow = false,
|
|
60
|
+
latenOverflow = false,
|
|
46
61
|
...otherBlueprintBreadcrumbsProps
|
|
47
|
-
}:
|
|
48
|
-
const renderBreadcrumb = (propsBreadcrumb:
|
|
62
|
+
}: BreadcrumbListProps) {
|
|
63
|
+
const renderBreadcrumb = (propsBreadcrumb: BreadcrumbItemProps) => {
|
|
49
64
|
const {onClick, ...otherProps} = propsBreadcrumb;
|
|
50
65
|
return (
|
|
51
66
|
<BreadcrumbItem
|
|
@@ -62,18 +77,25 @@ function BreadcrumbList({
|
|
|
62
77
|
);
|
|
63
78
|
};
|
|
64
79
|
|
|
65
|
-
const renderCurrentBreadcrumb = (propsBreadcrumb:
|
|
66
|
-
return <BreadcrumbItem {...propsBreadcrumb} current={true}
|
|
80
|
+
const renderCurrentBreadcrumb = (propsBreadcrumb: BreadcrumbItemProps) => {
|
|
81
|
+
return <BreadcrumbItem {...propsBreadcrumb} current={true} /*itemDivider={itemDivider}*/ />;
|
|
67
82
|
};
|
|
68
83
|
|
|
69
84
|
return (
|
|
70
85
|
<BlueprintBreadcrumbList
|
|
71
86
|
{...otherBlueprintBreadcrumbsProps}
|
|
72
87
|
{...htmlUlProps}
|
|
73
|
-
className={
|
|
88
|
+
className={
|
|
89
|
+
`${eccgui}-breadcrumb__list` +
|
|
90
|
+
(latenOverflow ? ` ${eccgui}-breadcrumb__list--latenoverflow` : "") +
|
|
91
|
+
(className ? ` ${className}` : "")
|
|
92
|
+
}
|
|
74
93
|
minVisibleItems={1}
|
|
75
94
|
breadcrumbRenderer={renderBreadcrumb}
|
|
76
95
|
currentBreadcrumbRenderer={renderCurrentBreadcrumb}
|
|
96
|
+
overflowListProps={ignoreOverflow ? {
|
|
97
|
+
minVisibleItems: otherBlueprintBreadcrumbsProps.items.length,
|
|
98
|
+
} : {}}
|
|
77
99
|
/>
|
|
78
100
|
);
|
|
79
101
|
}
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
height: auto;
|
|
6
6
|
|
|
7
7
|
& > li {
|
|
8
|
-
|
|
9
8
|
&:last-of-type {
|
|
10
9
|
min-width: 0;
|
|
11
10
|
}
|
|
@@ -39,9 +38,33 @@
|
|
|
39
38
|
}
|
|
40
39
|
}
|
|
41
40
|
|
|
41
|
+
.#{$eccgui}-breadcrumb__list--latenoverflow {
|
|
42
|
+
& > li {
|
|
43
|
+
flex-shrink: 1;
|
|
44
|
+
min-width: 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.#{$eccgui}-breadcrumb__item > * {
|
|
48
|
+
text-overflow: ellipsis;
|
|
49
|
+
overflow: hidden;
|
|
50
|
+
vertical-align: middle;
|
|
51
|
+
display: inline;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
42
55
|
.#{$eccgui}-breadcrumb__item {
|
|
43
56
|
font-size: inherit;
|
|
44
57
|
overflow: hidden;
|
|
45
58
|
text-overflow: ellipsis;
|
|
46
59
|
display: inline-block;
|
|
47
60
|
}
|
|
61
|
+
|
|
62
|
+
a.#{$eccgui}-breadcrumb__item {
|
|
63
|
+
&:not(.#{$ns}-breadcrumb-current):not(.#{$ns}-disabled) {
|
|
64
|
+
text-decoration: underline;
|
|
65
|
+
&:hover,
|
|
66
|
+
&:focus {
|
|
67
|
+
text-decoration: none;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
3
|
+
import { BreadcrumbItem } from './../../../index';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "Components/Breadcrumbs/Item",
|
|
7
|
+
component: BreadcrumbItem,
|
|
8
|
+
argTypes: {
|
|
9
|
+
},
|
|
10
|
+
} as ComponentMeta<typeof BreadcrumbItem>
|
|
11
|
+
|
|
12
|
+
const Template: ComponentStory<typeof BreadcrumbItem> = (args) => (
|
|
13
|
+
<BreadcrumbItem {...args} />
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export const Default = Template.bind({});
|
|
17
|
+
Default.args = {
|
|
18
|
+
text : 'Breadcrumb item',
|
|
19
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ComponentStory, ComponentMeta } from "@storybook/react";
|
|
3
|
+
import { BreadcrumbList, BreadcrumbItem } from './../../../index';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "Components/Breadcrumbs/List",
|
|
7
|
+
component: BreadcrumbList,
|
|
8
|
+
subcomponents: { BreadcrumbItem },
|
|
9
|
+
argTypes: {
|
|
10
|
+
},
|
|
11
|
+
} as ComponentMeta<typeof BreadcrumbList>
|
|
12
|
+
|
|
13
|
+
const Template: ComponentStory<typeof BreadcrumbList> = (args) => (
|
|
14
|
+
<BreadcrumbList {...args} />
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export const Default = Template.bind({});
|
|
18
|
+
Default.args = {
|
|
19
|
+
items : [
|
|
20
|
+
{text: "Root page", href : "#" },
|
|
21
|
+
{text: "Main click category", onClick: () => alert("Breadcrumb click")},
|
|
22
|
+
{text: <div>Sub category item</div>, href: "#"},
|
|
23
|
+
{text: <span>Disabled breadcrumb with a very long title</span>, disabled: true},
|
|
24
|
+
{text: "Current breadcrumb item", current: true}
|
|
25
|
+
],
|
|
26
|
+
};
|