|
@@ -1,6 +1,7 @@
|
|
|
import { Link } from "react-router-dom";
|
|
import { Link } from "react-router-dom";
|
|
|
-import { Breadcrumb } from "antd";
|
|
|
|
|
|
|
+import { Breadcrumb, Tooltip } from "antd";
|
|
|
import PaliText from "../template/Wbw/PaliText";
|
|
import PaliText from "../template/Wbw/PaliText";
|
|
|
|
|
+import React from "react";
|
|
|
|
|
|
|
|
export interface ITocPathNode {
|
|
export interface ITocPathNode {
|
|
|
book: number;
|
|
book: number;
|
|
@@ -13,17 +14,19 @@ export interface ITocPathNode {
|
|
|
export declare type ELinkType = "none" | "blank" | "self";
|
|
export declare type ELinkType = "none" | "blank" | "self";
|
|
|
|
|
|
|
|
interface IWidgetTocPath {
|
|
interface IWidgetTocPath {
|
|
|
- data: ITocPathNode[];
|
|
|
|
|
|
|
+ data?: ITocPathNode[];
|
|
|
|
|
+ trigger?: React.ReactNode;
|
|
|
link?: ELinkType;
|
|
link?: ELinkType;
|
|
|
channel?: string[];
|
|
channel?: string[];
|
|
|
onChange?: Function;
|
|
onChange?: Function;
|
|
|
}
|
|
}
|
|
|
const Widget = ({
|
|
const Widget = ({
|
|
|
- data,
|
|
|
|
|
|
|
+ data = [],
|
|
|
|
|
+ trigger,
|
|
|
link = "blank",
|
|
link = "blank",
|
|
|
channel,
|
|
channel,
|
|
|
onChange,
|
|
onChange,
|
|
|
-}: IWidgetTocPath) => {
|
|
|
|
|
|
|
+}: IWidgetTocPath): JSX.Element => {
|
|
|
let sChannel = "";
|
|
let sChannel = "";
|
|
|
if (typeof channel !== "undefined" && channel.length > 0) {
|
|
if (typeof channel !== "undefined" && channel.length > 0) {
|
|
|
sChannel = "_" + channel.join("_");
|
|
sChannel = "_" + channel.join("_");
|
|
@@ -61,11 +64,20 @@ const Widget = ({
|
|
|
</Breadcrumb.Item>
|
|
</Breadcrumb.Item>
|
|
|
);
|
|
);
|
|
|
});
|
|
});
|
|
|
- return (
|
|
|
|
|
- <>
|
|
|
|
|
- <Breadcrumb>{path}</Breadcrumb>
|
|
|
|
|
- </>
|
|
|
|
|
|
|
+ const fullPath = (
|
|
|
|
|
+ <Breadcrumb style={{ whiteSpace: "nowrap", width: "100%" }}>
|
|
|
|
|
+ {path}
|
|
|
|
|
+ </Breadcrumb>
|
|
|
);
|
|
);
|
|
|
|
|
+ if (typeof trigger === "undefined") {
|
|
|
|
|
+ return fullPath;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return (
|
|
|
|
|
+ <Tooltip placement="bottom" title={fullPath}>
|
|
|
|
|
+ {trigger}
|
|
|
|
|
+ </Tooltip>
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
export default Widget;
|
|
export default Widget;
|