piral-breadcrumbs 1.0.0-pre.2077 → 1.0.1-beta.5640
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/LICENSE +1 -1
- package/README.md +16 -2
- package/esm/Breadcrumbs.d.ts +2 -0
- package/esm/Breadcrumbs.js +23 -0
- package/esm/Breadcrumbs.js.map +1 -0
- package/esm/actions.d.ts +4 -0
- package/esm/actions.js +11 -0
- package/esm/actions.js.map +1 -0
- package/esm/components.d.ts +3 -0
- package/esm/components.js +4 -0
- package/esm/components.js.map +1 -0
- package/esm/create.d.ts +16 -0
- package/esm/create.js +80 -0
- package/esm/create.js.map +1 -0
- package/esm/default.d.ts +4 -0
- package/esm/default.js +5 -0
- package/esm/default.js.map +1 -0
- package/esm/index.d.ts +5 -0
- package/esm/index.js +6 -0
- package/esm/index.js.map +1 -0
- package/esm/types.d.ts +112 -0
- package/esm/types.js +2 -0
- package/esm/types.js.map +1 -0
- package/esm/useBreadcrumbs.d.ts +2 -0
- package/esm/useBreadcrumbs.js +41 -0
- package/esm/useBreadcrumbs.js.map +1 -0
- package/lib/Breadcrumbs.js +18 -18
- package/lib/Breadcrumbs.js.map +1 -1
- package/lib/actions.d.ts +3 -3
- package/lib/actions.js +11 -9
- package/lib/actions.js.map +1 -1
- package/lib/components.d.ts +3 -4
- package/lib/components.js +3 -3
- package/lib/components.js.map +1 -1
- package/lib/create.js +45 -29
- package/lib/create.js.map +1 -1
- package/lib/default.js +6 -4
- package/lib/default.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/types.d.ts +21 -7
- package/lib/useBreadcrumbs.js +10 -10
- package/lib/useBreadcrumbs.js.map +1 -1
- package/package.json +34 -9
- package/piral-breadcrumbs.min.js +1 -0
- package/src/Breadcrumbs.test.tsx +14 -14
- package/src/actions.test.ts +12 -9
- package/src/actions.ts +11 -5
- package/src/components.tsx +2 -6
- package/src/create.test.ts +28 -27
- package/src/create.ts +46 -22
- package/src/default.test.tsx +9 -9
- package/src/types.ts +21 -8
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
|
-
[](https://piral.io)
|
|
2
2
|
|
|
3
|
-
# [Piral Breadcrumbs](https://piral.io) · [](https://github.com/smapiot/piral/blob/
|
|
3
|
+
# [Piral Breadcrumbs](https://piral.io) · [](https://github.com/smapiot/piral/blob/main/LICENSE) [](https://www.npmjs.com/package/piral-breadcrumbs) [](https://jestjs.io) [](https://gitter.im/piral-io/community)
|
|
4
4
|
|
|
5
5
|
This is plugin that only has a peer dependency to `piral-core`. What `piral-breadcrumbs` brings to the table is a set of Pilet API extensions that can be used with `piral` or `piral-core`.
|
|
6
6
|
|
|
7
|
+
## Why and When
|
|
8
|
+
|
|
9
|
+
Many applications use breadcrumbs, which are UI indicators of the current page and its place in the page hierachy. Breadcrumbs easily allow going upwards to the root page in hierachy. The problem in a distributed system is that the relation between the pages is not centrally managed nor can it reliably be inferred.
|
|
10
|
+
|
|
11
|
+
`piral-breadcrumbs` solves this problem by introducing the possibility of registering breadcrumb information stating how the breadcrumb should appear and where to place it in the hierachy. The hierachy is loosely coupled and resilient. Missing parent links are skipped to still come up with a consistent view.
|
|
12
|
+
|
|
13
|
+
Alternatives: Get the registered pages and come up with a set of conventions and rules to build the breadcrumbs dynamically without requiring explicit registration.
|
|
14
|
+
|
|
15
|
+
## Video
|
|
16
|
+
|
|
17
|
+
We also have a video for this plugin:
|
|
18
|
+
|
|
19
|
+
@[youtube](https://youtu.be/G7FJeNR-g28)
|
|
20
|
+
|
|
7
21
|
## Documentation
|
|
8
22
|
|
|
9
23
|
The following functions are brought to the Pilet API.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useLocation, useRouteMatch } from 'react-router';
|
|
4
|
+
import { PiralBreadcrumbsContainer, PiralBreadcrumbItem } from './components';
|
|
5
|
+
import { useBreadcrumbs } from './useBreadcrumbs';
|
|
6
|
+
export const Breadcrumbs = () => {
|
|
7
|
+
var _a;
|
|
8
|
+
const location = useLocation();
|
|
9
|
+
const breadcrumbs = useBreadcrumbs(location.pathname);
|
|
10
|
+
const currentIndex = breadcrumbs.length - 1;
|
|
11
|
+
const current = breadcrumbs[currentIndex];
|
|
12
|
+
const { params } = useRouteMatch((_a = current === null || current === void 0 ? void 0 : current.settings.path) !== null && _a !== void 0 ? _a : '/');
|
|
13
|
+
const children = breadcrumbs.map(({ settings }, i) => {
|
|
14
|
+
const { title, path } = settings, props = __rest(settings, ["title", "path"]);
|
|
15
|
+
const key = `bc_${i}_${settings.path}`;
|
|
16
|
+
const current = i === currentIndex;
|
|
17
|
+
const computedPath = path.replace(/:([A-Za-z0-9_]+)/g, (s, id) => { var _a; return (_a = params[id]) !== null && _a !== void 0 ? _a : s; });
|
|
18
|
+
return (React.createElement(PiralBreadcrumbItem, Object.assign({ key: key, current: current, path: computedPath }, props), title));
|
|
19
|
+
});
|
|
20
|
+
return React.createElement(PiralBreadcrumbsContainer, { children: children });
|
|
21
|
+
};
|
|
22
|
+
Breadcrumbs.displayName = 'Breadcrumbs';
|
|
23
|
+
//# sourceMappingURL=Breadcrumbs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Breadcrumbs.js","sourceRoot":"","sources":["../src/Breadcrumbs.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,CAAC,MAAM,WAAW,GAAa,GAAG,EAAE;;IACxC,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,MAAM,WAAW,GAAG,cAAc,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACtD,MAAM,YAAY,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,WAAW,CAAC,YAAY,CAAC,CAAC;IAC1C,MAAM,EAAE,MAAM,EAAE,GAAG,aAAa,CAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,CAAC,IAAI,mCAAI,GAAG,CAAC,CAAC;IAEhE,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,CAAC,EAAE,EAAE;QACnD,MAAM,EAAE,KAAK,EAAE,IAAI,KAAe,QAAQ,EAAlB,KAAK,UAAK,QAAQ,EAApC,iBAAyB,CAAW,CAAC;QAC3C,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;QACvC,MAAM,OAAO,GAAG,CAAC,KAAK,YAAY,CAAC;QACnC,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,WAAC,OAAA,MAAA,MAAM,CAAC,EAAE,CAAC,mCAAI,CAAC,CAAA,EAAA,CAAC,CAAC;QAEnF,OAAO,CACL,oBAAC,mBAAmB,kBAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,IAAM,KAAK,GAC3E,KAAK,CACc,CACvB,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,oBAAC,yBAAyB,IAAC,QAAQ,EAAE,QAAQ,GAAI,CAAC;AAC3D,CAAC,CAAC;AACF,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC"}
|
package/esm/actions.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { GlobalStateContext, Dict } from 'piral-core';
|
|
2
|
+
import { BreadcrumbRegistration } from './types';
|
|
3
|
+
export declare function registerBreadcrumbs(ctx: GlobalStateContext, values: Dict<BreadcrumbRegistration>): void;
|
|
4
|
+
export declare function unregisterBreadcrumbs(ctx: GlobalStateContext, names: Array<string>): void;
|
package/esm/actions.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
export function registerBreadcrumbs(ctx, values) {
|
|
3
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { registry: Object.assign(Object.assign({}, state.registry), { breadcrumbs: Object.assign(Object.assign({}, state.registry.breadcrumbs), values) }) })));
|
|
4
|
+
}
|
|
5
|
+
export function unregisterBreadcrumbs(ctx, names) {
|
|
6
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { registry: Object.assign(Object.assign({}, state.registry), { breadcrumbs: names.reduce((prev, name) => {
|
|
7
|
+
const _a = prev, _b = name, _ = _a[_b], rest = __rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
|
|
8
|
+
return rest;
|
|
9
|
+
}, state.registry.breadcrumbs) }) })));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":";AAGA,MAAM,UAAU,mBAAmB,CAAC,GAAuB,EAAE,MAAoC;IAC/F,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,QAAQ,kCACH,KAAK,CAAC,QAAQ,KACjB,WAAW,kCACN,KAAK,CAAC,QAAQ,CAAC,WAAW,GAC1B,MAAM,QAGb,CAAC,CAAC;AACN,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,GAAuB,EAAE,KAAoB;IACjF,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,QAAQ,kCACH,KAAK,CAAC,QAAQ,KACjB,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;gBACvC,MAA+B,KAAA,IAAI,EAA3B,KAAC,IAAK,EAAE,CAAC,SAAA,EAAK,IAAI,cAApB,uCAAsB,CAAO,CAAC;gBACpC,OAAO,IAAI,CAAC;YACd,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,OAEhC,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,CAAC,MAAM,yBAAyB,GAAG,iBAAiB,CAAC,sBAAsB,CAAC,CAAC;AACnF,MAAM,CAAC,MAAM,mBAAmB,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,CAAC"}
|
package/esm/create.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PiralPlugin } from 'piral-core';
|
|
2
|
+
import { PiletBreadcrumbsApi, BreadcrumbSettings } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Available configuration options for the breadcrumbs plugin.
|
|
5
|
+
*/
|
|
6
|
+
export interface DashboardConfig {
|
|
7
|
+
/**
|
|
8
|
+
* Sets the breadcrumbs to be given by the app shell.
|
|
9
|
+
* @default []
|
|
10
|
+
*/
|
|
11
|
+
breadcrumbs?: Array<BreadcrumbSettings>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Creates the Pilet API extension for activating breadcrumbs support.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createBreadcrumbsApi(config?: DashboardConfig): PiralPlugin<PiletBreadcrumbsApi>;
|
package/esm/create.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import * as actions from './actions';
|
|
3
|
+
import { buildName, withRootExtension, withAll } from 'piral-core';
|
|
4
|
+
import { DefaultBreadbrumbItem, DefaultBreadcrumbsContainer } from './default';
|
|
5
|
+
import { Breadcrumbs } from './Breadcrumbs';
|
|
6
|
+
// Unfortunately `require`d:
|
|
7
|
+
// * exports are otherwise potentially converted by, e.g., Parcel (see #385)
|
|
8
|
+
const ptr = require('path-to-regexp');
|
|
9
|
+
function getMatcher(settings) {
|
|
10
|
+
if (settings.matcher instanceof RegExp) {
|
|
11
|
+
return settings.matcher;
|
|
12
|
+
}
|
|
13
|
+
else if (typeof settings.matcher === 'string') {
|
|
14
|
+
return ptr(settings.matcher);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
return ptr(settings.path);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function getBreadcrumbs(items) {
|
|
21
|
+
const breadcrumbs = {};
|
|
22
|
+
let i = 0;
|
|
23
|
+
for (const settings of items) {
|
|
24
|
+
breadcrumbs[`global-${i++}`] = {
|
|
25
|
+
pilet: undefined,
|
|
26
|
+
matcher: getMatcher(settings),
|
|
27
|
+
settings,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
return breadcrumbs;
|
|
31
|
+
}
|
|
32
|
+
function withBreadcrumbs(breadcrumbs) {
|
|
33
|
+
return (state) => (Object.assign(Object.assign({}, state), { components: Object.assign({ BreadcrumbItem: DefaultBreadbrumbItem, BreadcrumbsContainer: DefaultBreadcrumbsContainer }, state.components), registry: Object.assign(Object.assign({}, state.registry), { breadcrumbs }) }));
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Creates the Pilet API extension for activating breadcrumbs support.
|
|
37
|
+
*/
|
|
38
|
+
export function createBreadcrumbsApi(config = {}) {
|
|
39
|
+
const { breadcrumbs = [] } = config;
|
|
40
|
+
return (context) => {
|
|
41
|
+
context.defineActions(actions);
|
|
42
|
+
context.dispatch(withAll(withBreadcrumbs(getBreadcrumbs(breadcrumbs)), withRootExtension('piral-breadcrumbs', Breadcrumbs)));
|
|
43
|
+
return (_, target) => {
|
|
44
|
+
const pilet = target.name;
|
|
45
|
+
let next = 0;
|
|
46
|
+
return {
|
|
47
|
+
registerBreadcrumbs(values) {
|
|
48
|
+
const bc = {};
|
|
49
|
+
for (const value of values) {
|
|
50
|
+
const { name = next++ } = value, settings = __rest(value, ["name"]);
|
|
51
|
+
const id = buildName(pilet, name);
|
|
52
|
+
bc[id] = settings;
|
|
53
|
+
}
|
|
54
|
+
context.registerBreadcrumbs(bc);
|
|
55
|
+
return () => context.unregisterBreadcrumbs(Object.keys(bc));
|
|
56
|
+
},
|
|
57
|
+
registerBreadcrumb(name, settings) {
|
|
58
|
+
if (typeof name !== 'string') {
|
|
59
|
+
settings = name;
|
|
60
|
+
name = next++;
|
|
61
|
+
}
|
|
62
|
+
const id = buildName(pilet, name);
|
|
63
|
+
context.registerBreadcrumbs({
|
|
64
|
+
[id]: {
|
|
65
|
+
pilet,
|
|
66
|
+
matcher: getMatcher(settings),
|
|
67
|
+
settings,
|
|
68
|
+
},
|
|
69
|
+
});
|
|
70
|
+
return () => context.unregisterBreadcrumbs([id]);
|
|
71
|
+
},
|
|
72
|
+
unregisterBreadcrumb(name) {
|
|
73
|
+
const id = buildName(pilet, name);
|
|
74
|
+
context.unregisterBreadcrumbs([id]);
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=create.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,SAAS,EAAqB,iBAAiB,EAAE,OAAO,EAAe,MAAM,YAAY,CAAC;AACnG,OAAO,EAAE,qBAAqB,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,4BAA4B;AAC5B,4EAA4E;AAC5E,MAAM,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D,oBAAoB,CAAC,IAAI;oBACvB,MAAM,EAAE,GAAG,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;oBAClC,OAAO,CAAC,qBAAqB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBACtC,CAAC;aACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
package/esm/default.d.ts
ADDED
package/esm/default.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ExtensionSlot, defaultRender } from 'piral-core';
|
|
3
|
+
export const DefaultBreadcrumbsContainer = (props) => (React.createElement(ExtensionSlot, { name: "breadcrumbs", params: props, empty: () => defaultRender(props.children, 'default_breadcrumbs') }));
|
|
4
|
+
export const DefaultBreadbrumbItem = (props) => defaultRender(props.children);
|
|
5
|
+
//# sourceMappingURL=default.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default.js","sourceRoot":"","sources":["../src/default.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAG1D,MAAM,CAAC,MAAM,2BAA2B,GAAwC,CAAC,KAAK,EAAE,EAAE,CAAC,CACzF,oBAAC,aAAa,IAAC,IAAI,EAAC,aAAa,EAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,EAAE,qBAAqB,CAAC,GAAI,CACvH,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAkC,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC"}
|
package/esm/index.d.ts
ADDED
package/esm/index.js
ADDED
package/esm/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC"}
|
package/esm/types.d.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import type { ComponentType, ReactNode } from 'react';
|
|
2
|
+
import type { Dict, BaseRegistration, RegistrationDisposer } from 'piral-core';
|
|
3
|
+
declare module 'piral-core/lib/types/custom' {
|
|
4
|
+
interface PiletCustomApi extends PiletBreadcrumbsApi {
|
|
5
|
+
}
|
|
6
|
+
interface PiralCustomState {
|
|
7
|
+
}
|
|
8
|
+
interface PiralCustomActions {
|
|
9
|
+
/**
|
|
10
|
+
* Registers a new breadcrumb.
|
|
11
|
+
* @param values The breadcrumbs to register.
|
|
12
|
+
*/
|
|
13
|
+
registerBreadcrumbs(values: Dict<BreadcrumbRegistration>): void;
|
|
14
|
+
/**
|
|
15
|
+
* Unregisters an existing breadcrumb.
|
|
16
|
+
* @param name The name of the breadcrumb to be removed.
|
|
17
|
+
*/
|
|
18
|
+
unregisterBreadcrumbs(names: Array<string>): void;
|
|
19
|
+
}
|
|
20
|
+
interface PiralCustomRegistryState {
|
|
21
|
+
/**
|
|
22
|
+
* The registered breadcrumbs.
|
|
23
|
+
*/
|
|
24
|
+
breadcrumbs: Dict<BreadcrumbRegistration>;
|
|
25
|
+
}
|
|
26
|
+
interface PiralCustomComponentsState {
|
|
27
|
+
/**
|
|
28
|
+
* The breadcrumbs container component.
|
|
29
|
+
*/
|
|
30
|
+
BreadcrumbsContainer: ComponentType<BreadcrumbsContainerProps>;
|
|
31
|
+
/**
|
|
32
|
+
* The breadcrumb item component.
|
|
33
|
+
*/
|
|
34
|
+
BreadcrumbItem: ComponentType<BreadcrumbItemProps>;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export interface BreadcrumbsContainerProps {
|
|
38
|
+
/**
|
|
39
|
+
* The breadcrumbs to display.
|
|
40
|
+
*/
|
|
41
|
+
children?: ReactNode;
|
|
42
|
+
}
|
|
43
|
+
export interface BreadcrumbItemProps extends Omit<BreadcrumbSettings, 'title'> {
|
|
44
|
+
/**
|
|
45
|
+
* Determins if the breadcrumb is the current page.
|
|
46
|
+
*/
|
|
47
|
+
current: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* The title of the breadcrumb to display.
|
|
50
|
+
*/
|
|
51
|
+
children?: ReactNode;
|
|
52
|
+
}
|
|
53
|
+
export interface PiralCustomBreadcrumbSettings {
|
|
54
|
+
}
|
|
55
|
+
export interface BreadcrumbSettings extends PiralCustomBreadcrumbSettings {
|
|
56
|
+
/**
|
|
57
|
+
* Gets the path of breadcrumb for navigation purposes.
|
|
58
|
+
*/
|
|
59
|
+
path: string;
|
|
60
|
+
/**
|
|
61
|
+
* Gets a custom matching function to know if the breadcrumb should be selected.
|
|
62
|
+
*
|
|
63
|
+
* In case of a missing matcher it uses the path to regexp result of the given path.
|
|
64
|
+
*
|
|
65
|
+
* In case of a string it uses the path to regexp result of the given matcher.
|
|
66
|
+
*/
|
|
67
|
+
matcher?: string | RegExp;
|
|
68
|
+
/**
|
|
69
|
+
* The breadcrumb's parent breadcrumb. Supply the path of the breadcrumb here, e.g.,
|
|
70
|
+
* if we are currently in "/foo/bar", you could provide "/foo" to get the breadcrumb
|
|
71
|
+
* associated with the path "/foo".
|
|
72
|
+
*
|
|
73
|
+
* If a path is missing for some reason, the closest matching one will be taken as
|
|
74
|
+
* parent.
|
|
75
|
+
*/
|
|
76
|
+
parent?: string;
|
|
77
|
+
/**
|
|
78
|
+
* The title of the breadcrumb.
|
|
79
|
+
*/
|
|
80
|
+
title: ReactNode;
|
|
81
|
+
}
|
|
82
|
+
export interface BreadcrumbRegistration extends BaseRegistration {
|
|
83
|
+
matcher: RegExp;
|
|
84
|
+
settings: BreadcrumbSettings;
|
|
85
|
+
}
|
|
86
|
+
export interface PiletBreadcrumbsApi {
|
|
87
|
+
/**
|
|
88
|
+
* Registers a set of breadcrumbs.
|
|
89
|
+
* @param values The different breadcrumb settings.
|
|
90
|
+
*/
|
|
91
|
+
registerBreadcrumbs(values: Array<{
|
|
92
|
+
name?: string;
|
|
93
|
+
} & BreadcrumbSettings>): RegistrationDisposer;
|
|
94
|
+
/**
|
|
95
|
+
* Registers a breadcrumb with the provided settings.
|
|
96
|
+
* @param settings The settings for configuring the breadcrumb.
|
|
97
|
+
*/
|
|
98
|
+
registerBreadcrumb(settings: BreadcrumbSettings): RegistrationDisposer;
|
|
99
|
+
/**
|
|
100
|
+
* Registers a named breadcrumb with the provided settings.
|
|
101
|
+
* The name has to be unique within the current pilet.
|
|
102
|
+
* @param name The name of the breadcrumb.
|
|
103
|
+
* @param settings The settings for configuring the breadcrumb.
|
|
104
|
+
*/
|
|
105
|
+
registerBreadcrumb(name: string, settings: BreadcrumbSettings): RegistrationDisposer;
|
|
106
|
+
/**
|
|
107
|
+
* Unregisters a breadcrumb known by the given name.
|
|
108
|
+
* Only previously registered tiles can be unregistered.
|
|
109
|
+
* @param name The name of the breadcrumb to unregister.
|
|
110
|
+
*/
|
|
111
|
+
unregisterBreadcrumb(name: string): void;
|
|
112
|
+
}
|
package/esm/types.js
ADDED
package/esm/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useGlobalState } from 'piral-core';
|
|
2
|
+
function getExact(breadcrumbs, path) {
|
|
3
|
+
const [bc] = breadcrumbs.filter((m) => m.matcher.test(path));
|
|
4
|
+
return bc;
|
|
5
|
+
}
|
|
6
|
+
function getClosest(breadcrumbs, path) {
|
|
7
|
+
const segments = path.split('/');
|
|
8
|
+
while (segments.length > 1) {
|
|
9
|
+
segments.pop();
|
|
10
|
+
const newPath = segments.join('/');
|
|
11
|
+
const next = getNext(breadcrumbs, newPath);
|
|
12
|
+
if (next) {
|
|
13
|
+
return next;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
function getNext(breadcrumbs, path) {
|
|
19
|
+
if (path) {
|
|
20
|
+
return getExact(breadcrumbs, path) || getClosest(breadcrumbs, path);
|
|
21
|
+
}
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
export function useBreadcrumbs(path) {
|
|
25
|
+
const breadcrumbs = useGlobalState((s) => s.registry.breadcrumbs);
|
|
26
|
+
const list = Object.keys(breadcrumbs).map((id) => breadcrumbs[id]);
|
|
27
|
+
if (list.length > 0) {
|
|
28
|
+
const current = getNext(list, path);
|
|
29
|
+
if (current) {
|
|
30
|
+
const links = [current];
|
|
31
|
+
let previous = getNext(list, current.settings.parent);
|
|
32
|
+
while (previous !== undefined) {
|
|
33
|
+
links.push(previous);
|
|
34
|
+
previous = getNext(list, previous.settings.parent);
|
|
35
|
+
}
|
|
36
|
+
return links.reverse();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=useBreadcrumbs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useBreadcrumbs.js","sourceRoot":"","sources":["../src/useBreadcrumbs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAG5C,SAAS,QAAQ,CAAC,WAA0C,EAAE,IAAY;IACxE,MAAM,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7D,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,SAAS,UAAU,CAAC,WAA0C,EAAE,IAAY;IAC1E,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,C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,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;aACpD;YAED,OAAO,KAAK,CAAC,OAAO,EAAE,CAAC;SACxB;KACF;IAED,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
package/lib/Breadcrumbs.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Breadcrumbs = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const React = require("react");
|
|
6
|
+
const react_router_1 = require("react-router");
|
|
7
|
+
const components_1 = require("./components");
|
|
8
|
+
const useBreadcrumbs_1 = require("./useBreadcrumbs");
|
|
9
|
+
const Breadcrumbs = () => {
|
|
10
10
|
var _a;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
return (React.createElement(components_1.PiralBreadcrumbItem, tslib_1.__assign({ key: key, current: current, path: computedPath }, props), title));
|
|
11
|
+
const location = (0, react_router_1.useLocation)();
|
|
12
|
+
const breadcrumbs = (0, useBreadcrumbs_1.useBreadcrumbs)(location.pathname);
|
|
13
|
+
const currentIndex = breadcrumbs.length - 1;
|
|
14
|
+
const current = breadcrumbs[currentIndex];
|
|
15
|
+
const { params } = (0, react_router_1.useRouteMatch)((_a = current === null || current === void 0 ? void 0 : current.settings.path) !== null && _a !== void 0 ? _a : '/');
|
|
16
|
+
const children = breadcrumbs.map(({ settings }, i) => {
|
|
17
|
+
const { title, path } = settings, props = tslib_1.__rest(settings, ["title", "path"]);
|
|
18
|
+
const key = `bc_${i}_${settings.path}`;
|
|
19
|
+
const current = i === currentIndex;
|
|
20
|
+
const computedPath = path.replace(/:([A-Za-z0-9_]+)/g, (s, id) => { var _a; return (_a = params[id]) !== null && _a !== void 0 ? _a : s; });
|
|
21
|
+
return (React.createElement(components_1.PiralBreadcrumbItem, Object.assign({ key: key, current: current, path: computedPath }, props), title));
|
|
23
22
|
});
|
|
24
23
|
return React.createElement(components_1.PiralBreadcrumbsContainer, { children: children });
|
|
25
24
|
};
|
|
25
|
+
exports.Breadcrumbs = Breadcrumbs;
|
|
26
26
|
exports.Breadcrumbs.displayName = 'Breadcrumbs';
|
|
27
27
|
//# sourceMappingURL=Breadcrumbs.js.map
|
package/lib/Breadcrumbs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Breadcrumbs.js","sourceRoot":"","sources":["../src/Breadcrumbs.tsx"],"names":[],"mappings":";;;;AAAA
|
|
1
|
+
{"version":3,"file":"Breadcrumbs.js","sourceRoot":"","sources":["../src/Breadcrumbs.tsx"],"names":[],"mappings":";;;;AAAA,+BAA+B;AAC/B,+CAA0D;AAC1D,6CAA8E;AAC9E,qDAAkD;AAE3C,MAAM,WAAW,GAAa,GAAG,EAAE;;IACxC,MAAM,QAAQ,GAAG,IAAA,0BAAW,GAAE,CAAC;IAC/B,MAAM,WAAW,GAAG,IAAA,+BAAc,EAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACtD,MAAM,YAAY,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC;IAC5C,MAAM,OAAO,GAAG,WAAW,CAAC,YAAY,CAAC,CAAC;IAC1C,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,4BAAa,EAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,CAAC,IAAI,mCAAI,GAAG,CAAC,CAAC;IAEhE,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,CAAC,EAAE,EAAE;QACnD,MAAM,EAAE,KAAK,EAAE,IAAI,KAAe,QAAQ,EAAlB,KAAK,kBAAK,QAAQ,EAApC,iBAAyB,CAAW,CAAC;QAC3C,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;QACvC,MAAM,OAAO,GAAG,CAAC,KAAK,YAAY,CAAC;QACnC,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,WAAC,OAAA,MAAA,MAAM,CAAC,EAAE,CAAC,mCAAI,CAAC,CAAA,EAAA,CAAC,CAAC;QAEnF,OAAO,CACL,oBAAC,gCAAmB,kBAAC,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,IAAM,KAAK,GAC3E,KAAK,CACc,CACvB,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,oBAAC,sCAAyB,IAAC,QAAQ,EAAE,QAAQ,GAAI,CAAC;AAC3D,CAAC,CAAC;AArBW,QAAA,WAAW,eAqBtB;AACF,mBAAW,CAAC,WAAW,GAAG,aAAa,CAAC"}
|
package/lib/actions.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GlobalStateContext } from 'piral-core';
|
|
1
|
+
import type { GlobalStateContext, Dict } from 'piral-core';
|
|
2
2
|
import { BreadcrumbRegistration } from './types';
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function
|
|
3
|
+
export declare function registerBreadcrumbs(ctx: GlobalStateContext, values: Dict<BreadcrumbRegistration>): void;
|
|
4
|
+
export declare function unregisterBreadcrumbs(ctx: GlobalStateContext, names: Array<string>): void;
|
package/lib/actions.js
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
ctx.dispatch(function (state) { return (tslib_1.__assign(tslib_1.__assign({}, state), { registry: tslib_1.__assign(tslib_1.__assign({}, state.registry), { breadcrumbs: piral_core_1.withKey(state.registry.breadcrumbs, name, value) }) })); });
|
|
3
|
+
exports.unregisterBreadcrumbs = exports.registerBreadcrumbs = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
function registerBreadcrumbs(ctx, values) {
|
|
6
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { registry: Object.assign(Object.assign({}, state.registry), { breadcrumbs: Object.assign(Object.assign({}, state.registry.breadcrumbs), values) }) })));
|
|
8
7
|
}
|
|
9
|
-
exports.
|
|
10
|
-
function
|
|
11
|
-
ctx.dispatch(
|
|
8
|
+
exports.registerBreadcrumbs = registerBreadcrumbs;
|
|
9
|
+
function unregisterBreadcrumbs(ctx, names) {
|
|
10
|
+
ctx.dispatch((state) => (Object.assign(Object.assign({}, state), { registry: Object.assign(Object.assign({}, state.registry), { breadcrumbs: names.reduce((prev, name) => {
|
|
11
|
+
const _a = prev, _b = name, _ = _a[_b], rest = tslib_1.__rest(_a, [typeof _b === "symbol" ? _b : _b + ""]);
|
|
12
|
+
return rest;
|
|
13
|
+
}, state.registry.breadcrumbs) }) })));
|
|
12
14
|
}
|
|
13
|
-
exports.
|
|
15
|
+
exports.unregisterBreadcrumbs = unregisterBreadcrumbs;
|
|
14
16
|
//# sourceMappingURL=actions.js.map
|
package/lib/actions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":";;;;AAGA,SAAgB,mBAAmB,CAAC,GAAuB,EAAE,MAAoC;IAC/F,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,QAAQ,kCACH,KAAK,CAAC,QAAQ,KACjB,WAAW,kCACN,KAAK,CAAC,QAAQ,CAAC,WAAW,GAC1B,MAAM,QAGb,CAAC,CAAC;AACN,CAAC;AAXD,kDAWC;AAED,SAAgB,qBAAqB,CAAC,GAAuB,EAAE,KAAoB;IACjF,GAAG,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iCACnB,KAAK,KACR,QAAQ,kCACH,KAAK,CAAC,QAAQ,KACjB,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;gBACvC,MAA+B,KAAA,IAAI,EAA3B,KAAC,IAAK,EAAE,CAAC,SAAA,EAAK,IAAI,sBAApB,uCAAsB,CAAO,CAAC;gBACpC,OAAO,IAAI,CAAC;YACd,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,OAEhC,CAAC,CAAC;AACN,CAAC;AAXD,sDAWC"}
|
package/lib/components.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const PiralBreadcrumbItem: React.ComponentType<BreadcrumbItemProps>;
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const PiralBreadcrumbsContainer: import("react").ComponentType<import("./types").BreadcrumbsContainerProps>;
|
|
3
|
+
export declare const PiralBreadcrumbItem: import("react").ComponentType<import("./types").BreadcrumbItemProps>;
|
package/lib/components.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PiralBreadcrumbItem = exports.PiralBreadcrumbsContainer = void 0;
|
|
4
|
-
|
|
5
|
-
exports.PiralBreadcrumbsContainer = piral_core_1.getPiralComponent('BreadcrumbsContainer');
|
|
6
|
-
exports.PiralBreadcrumbItem = piral_core_1.getPiralComponent('BreadcrumbItem');
|
|
4
|
+
const piral_core_1 = require("piral-core");
|
|
5
|
+
exports.PiralBreadcrumbsContainer = (0, piral_core_1.getPiralComponent)('BreadcrumbsContainer');
|
|
6
|
+
exports.PiralBreadcrumbItem = (0, piral_core_1.getPiralComponent)('BreadcrumbItem');
|
|
7
7
|
//# sourceMappingURL=components.js.map
|
package/lib/components.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":";;;AAAA,2CAA+C;AAElC,QAAA,yBAAyB,GAAG,IAAA,8BAAiB,EAAC,sBAAsB,CAAC,CAAC;AACtE,QAAA,mBAAmB,GAAG,IAAA,8BAAiB,EAAC,gBAAgB,CAAC,CAAC"}
|