@cfmm/umi-plugins-ui-v2 0.0.34 → 0.0.35
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/dist/cjs/components/HelpDocButton.tpl +5 -2
- package/dist/cjs/locales/enUS/HelpDocButton.js +2 -2
- package/dist/cjs/locales/zhTW/HelpDocButton.js +2 -2
- package/dist/cjs/types/HelpDocButtonTypes.d.ts +1 -1
- package/dist/cjs/types/HelpDocButtonTypes.js +1 -1
- package/dist/esm/components/HelpDocButton.tpl +5 -2
- package/dist/esm/locales/enUS/HelpDocButton.js +2 -2
- package/dist/esm/locales/zhTW/HelpDocButton.js +2 -2
- package/dist/esm/types/HelpDocButtonTypes.d.ts +1 -1
- package/dist/esm/types/HelpDocButtonTypes.js +1 -1
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import React, { useMemo } from 'react';
|
|
|
5
5
|
import { HelpDocButtonProps } from '../types';
|
|
6
6
|
|
|
7
7
|
const HelpDocButton = (props: HelpDocButtonProps) => {
|
|
8
|
-
const { title, hint, href, tooltipProps, ...buttonProps } = props;
|
|
8
|
+
const { title, hint, href, defaultLocale = 'en-US', tooltipProps, ...buttonProps } = props;
|
|
9
9
|
|
|
10
10
|
const { formatMessage } = useIntl();
|
|
11
11
|
const selectedRoutes = useSelectedRoutes();
|
|
@@ -27,7 +27,9 @@ const HelpDocButton = (props: HelpDocButtonProps) => {
|
|
|
27
27
|
docsUrl = `http://${window.location.hostname}:81/`;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
const isEn = locale?.replace(/-|_/g, '').toLowerCase() === defaultLocale?.replace(/-|_/g, '').toLowerCase();
|
|
31
|
+
|
|
32
|
+
return `${docsUrl}${isEn ? '' : `${locale}/`}service-doc/${newUrl}`;
|
|
31
33
|
}, [routePath, href, locale]);
|
|
32
34
|
|
|
33
35
|
const handleTitle = useMemo(() => {
|
|
@@ -68,6 +70,7 @@ const HelpDocButton = (props: HelpDocButtonProps) => {
|
|
|
68
70
|
* @param props - 组件属性
|
|
69
71
|
* @param props.href - 帮助文档地址前缀
|
|
70
72
|
* @param props.title - 按钮标题,默认为帮助文档,传字符串覆盖,传false只显示icon
|
|
73
|
+
* @param props.defaultLocale - 文档默认语言,跳转不带语言前缀,默认en-US
|
|
71
74
|
* @param props.hint - 提示文字,默认有一行 ‘点击查看帮助文档’,传入tooltipProps.title可覆盖
|
|
72
75
|
* @param props.tooltipProps - 提示框属性
|
|
73
76
|
* @param props.buttonProps - 按钮属性
|
|
@@ -5,6 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _default = exports.default = {
|
|
8
|
-
"cfmmUI.HelpDocButton.title": "
|
|
9
|
-
"cfmmUI.HelpDocButton.hint": "
|
|
8
|
+
"cfmmUI.HelpDocButton.title": "Help Documents",
|
|
9
|
+
"cfmmUI.HelpDocButton.hint": "Click To View The Help Documents"
|
|
10
10
|
};
|
|
@@ -5,6 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _default = exports.default = {
|
|
8
|
-
"cfmmUI.HelpDocButton.title": "
|
|
9
|
-
"cfmmUI.HelpDocButton.hint": "
|
|
8
|
+
"cfmmUI.HelpDocButton.title": "幫助文檔",
|
|
9
|
+
"cfmmUI.HelpDocButton.hint": "點擊查看幫助文檔"
|
|
10
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const HelpDocButtonTypes = "\ninterface HelpDocButtonProps extends Omit<ButtonProps, 'title'> {\n /** \u6309\u94AE\u6807\u9898\uFF0C\u9ED8\u8BA4\u4E3A\u5E2E\u52A9\u6587\u6863\uFF0C\u4F20\u5B57\u7B26\u4E32\u8986\u76D6\uFF0C\u4F20false\u53EA\u663E\u793Aicon */\n title?: React.ReactNode | boolean;\n /** \u63D0\u793A\u6587\u5B57\uFF0C\u9ED8\u8BA4\u6709\u4E00\u884C \u2018\u70B9\u51FB\u67E5\u770B\u5E2E\u52A9\u6587\u6863\u2019\uFF0C\u4F20\u5165tooltipProps.title\u53EF\u8986\u76D6 */\n hint?: React.ReactNode;\n /** \u63D0\u793A\u6846\u5C5E\u6027 */\n tooltipProps?: TooltipProps;\n}\n";
|
|
1
|
+
export declare const HelpDocButtonTypes = "\ninterface HelpDocButtonProps extends Omit<ButtonProps, 'title'> {\n /** \u6309\u94AE\u6807\u9898\uFF0C\u9ED8\u8BA4\u4E3A\u5E2E\u52A9\u6587\u6863\uFF0C\u4F20\u5B57\u7B26\u4E32\u8986\u76D6\uFF0C\u4F20false\u53EA\u663E\u793Aicon */\n title?: React.ReactNode | boolean;\n /** \u63D0\u793A\u6587\u5B57\uFF0C\u9ED8\u8BA4\u6709\u4E00\u884C \u2018\u70B9\u51FB\u67E5\u770B\u5E2E\u52A9\u6587\u6863\u2019\uFF0C\u4F20\u5165tooltipProps.title\u53EF\u8986\u76D6 */\n hint?: React.ReactNode;\n /** \u6587\u6863\u9ED8\u8BA4\u8BED\u8A00\uFF0C\u8DF3\u8F6C\u4E0D\u5E26\u8BED\u8A00\u524D\u7F00\uFF0C\u9ED8\u8BA4en-US */\n defaultLocale?: string;\n /** \u63D0\u793A\u6846\u5C5E\u6027 */\n tooltipProps?: TooltipProps;\n}\n";
|
|
@@ -4,4 +4,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.HelpDocButtonTypes = void 0;
|
|
7
|
-
var HelpDocButtonTypes = exports.HelpDocButtonTypes = "\ninterface HelpDocButtonProps extends Omit<ButtonProps, 'title'> {\n /** \u6309\u94AE\u6807\u9898\uFF0C\u9ED8\u8BA4\u4E3A\u5E2E\u52A9\u6587\u6863\uFF0C\u4F20\u5B57\u7B26\u4E32\u8986\u76D6\uFF0C\u4F20false\u53EA\u663E\u793Aicon */\n title?: React.ReactNode | boolean;\n /** \u63D0\u793A\u6587\u5B57\uFF0C\u9ED8\u8BA4\u6709\u4E00\u884C \u2018\u70B9\u51FB\u67E5\u770B\u5E2E\u52A9\u6587\u6863\u2019\uFF0C\u4F20\u5165tooltipProps.title\u53EF\u8986\u76D6 */\n hint?: React.ReactNode;\n /** \u63D0\u793A\u6846\u5C5E\u6027 */\n tooltipProps?: TooltipProps;\n}\n";
|
|
7
|
+
var HelpDocButtonTypes = exports.HelpDocButtonTypes = "\ninterface HelpDocButtonProps extends Omit<ButtonProps, 'title'> {\n /** \u6309\u94AE\u6807\u9898\uFF0C\u9ED8\u8BA4\u4E3A\u5E2E\u52A9\u6587\u6863\uFF0C\u4F20\u5B57\u7B26\u4E32\u8986\u76D6\uFF0C\u4F20false\u53EA\u663E\u793Aicon */\n title?: React.ReactNode | boolean;\n /** \u63D0\u793A\u6587\u5B57\uFF0C\u9ED8\u8BA4\u6709\u4E00\u884C \u2018\u70B9\u51FB\u67E5\u770B\u5E2E\u52A9\u6587\u6863\u2019\uFF0C\u4F20\u5165tooltipProps.title\u53EF\u8986\u76D6 */\n hint?: React.ReactNode;\n /** \u6587\u6863\u9ED8\u8BA4\u8BED\u8A00\uFF0C\u8DF3\u8F6C\u4E0D\u5E26\u8BED\u8A00\u524D\u7F00\uFF0C\u9ED8\u8BA4en-US */\n defaultLocale?: string;\n /** \u63D0\u793A\u6846\u5C5E\u6027 */\n tooltipProps?: TooltipProps;\n}\n";
|
|
@@ -5,7 +5,7 @@ import React, { useMemo } from 'react';
|
|
|
5
5
|
import { HelpDocButtonProps } from '../types';
|
|
6
6
|
|
|
7
7
|
const HelpDocButton = (props: HelpDocButtonProps) => {
|
|
8
|
-
const { title, hint, href, tooltipProps, ...buttonProps } = props;
|
|
8
|
+
const { title, hint, href, defaultLocale = 'en-US', tooltipProps, ...buttonProps } = props;
|
|
9
9
|
|
|
10
10
|
const { formatMessage } = useIntl();
|
|
11
11
|
const selectedRoutes = useSelectedRoutes();
|
|
@@ -27,7 +27,9 @@ const HelpDocButton = (props: HelpDocButtonProps) => {
|
|
|
27
27
|
docsUrl = `http://${window.location.hostname}:81/`;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
const isEn = locale?.replace(/-|_/g, '').toLowerCase() === defaultLocale?.replace(/-|_/g, '').toLowerCase();
|
|
31
|
+
|
|
32
|
+
return `${docsUrl}${isEn ? '' : `${locale}/`}service-doc/${newUrl}`;
|
|
31
33
|
}, [routePath, href, locale]);
|
|
32
34
|
|
|
33
35
|
const handleTitle = useMemo(() => {
|
|
@@ -68,6 +70,7 @@ const HelpDocButton = (props: HelpDocButtonProps) => {
|
|
|
68
70
|
* @param props - 组件属性
|
|
69
71
|
* @param props.href - 帮助文档地址前缀
|
|
70
72
|
* @param props.title - 按钮标题,默认为帮助文档,传字符串覆盖,传false只显示icon
|
|
73
|
+
* @param props.defaultLocale - 文档默认语言,跳转不带语言前缀,默认en-US
|
|
71
74
|
* @param props.hint - 提示文字,默认有一行 ‘点击查看帮助文档’,传入tooltipProps.title可覆盖
|
|
72
75
|
* @param props.tooltipProps - 提示框属性
|
|
73
76
|
* @param props.buttonProps - 按钮属性
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const HelpDocButtonTypes = "\ninterface HelpDocButtonProps extends Omit<ButtonProps, 'title'> {\n /** \u6309\u94AE\u6807\u9898\uFF0C\u9ED8\u8BA4\u4E3A\u5E2E\u52A9\u6587\u6863\uFF0C\u4F20\u5B57\u7B26\u4E32\u8986\u76D6\uFF0C\u4F20false\u53EA\u663E\u793Aicon */\n title?: React.ReactNode | boolean;\n /** \u63D0\u793A\u6587\u5B57\uFF0C\u9ED8\u8BA4\u6709\u4E00\u884C \u2018\u70B9\u51FB\u67E5\u770B\u5E2E\u52A9\u6587\u6863\u2019\uFF0C\u4F20\u5165tooltipProps.title\u53EF\u8986\u76D6 */\n hint?: React.ReactNode;\n /** \u63D0\u793A\u6846\u5C5E\u6027 */\n tooltipProps?: TooltipProps;\n}\n";
|
|
1
|
+
export declare const HelpDocButtonTypes = "\ninterface HelpDocButtonProps extends Omit<ButtonProps, 'title'> {\n /** \u6309\u94AE\u6807\u9898\uFF0C\u9ED8\u8BA4\u4E3A\u5E2E\u52A9\u6587\u6863\uFF0C\u4F20\u5B57\u7B26\u4E32\u8986\u76D6\uFF0C\u4F20false\u53EA\u663E\u793Aicon */\n title?: React.ReactNode | boolean;\n /** \u63D0\u793A\u6587\u5B57\uFF0C\u9ED8\u8BA4\u6709\u4E00\u884C \u2018\u70B9\u51FB\u67E5\u770B\u5E2E\u52A9\u6587\u6863\u2019\uFF0C\u4F20\u5165tooltipProps.title\u53EF\u8986\u76D6 */\n hint?: React.ReactNode;\n /** \u6587\u6863\u9ED8\u8BA4\u8BED\u8A00\uFF0C\u8DF3\u8F6C\u4E0D\u5E26\u8BED\u8A00\u524D\u7F00\uFF0C\u9ED8\u8BA4en-US */\n defaultLocale?: string;\n /** \u63D0\u793A\u6846\u5C5E\u6027 */\n tooltipProps?: TooltipProps;\n}\n";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export var HelpDocButtonTypes = "\ninterface HelpDocButtonProps extends Omit<ButtonProps, 'title'> {\n /** \u6309\u94AE\u6807\u9898\uFF0C\u9ED8\u8BA4\u4E3A\u5E2E\u52A9\u6587\u6863\uFF0C\u4F20\u5B57\u7B26\u4E32\u8986\u76D6\uFF0C\u4F20false\u53EA\u663E\u793Aicon */\n title?: React.ReactNode | boolean;\n /** \u63D0\u793A\u6587\u5B57\uFF0C\u9ED8\u8BA4\u6709\u4E00\u884C \u2018\u70B9\u51FB\u67E5\u770B\u5E2E\u52A9\u6587\u6863\u2019\uFF0C\u4F20\u5165tooltipProps.title\u53EF\u8986\u76D6 */\n hint?: React.ReactNode;\n /** \u63D0\u793A\u6846\u5C5E\u6027 */\n tooltipProps?: TooltipProps;\n}\n";
|
|
1
|
+
export var HelpDocButtonTypes = "\ninterface HelpDocButtonProps extends Omit<ButtonProps, 'title'> {\n /** \u6309\u94AE\u6807\u9898\uFF0C\u9ED8\u8BA4\u4E3A\u5E2E\u52A9\u6587\u6863\uFF0C\u4F20\u5B57\u7B26\u4E32\u8986\u76D6\uFF0C\u4F20false\u53EA\u663E\u793Aicon */\n title?: React.ReactNode | boolean;\n /** \u63D0\u793A\u6587\u5B57\uFF0C\u9ED8\u8BA4\u6709\u4E00\u884C \u2018\u70B9\u51FB\u67E5\u770B\u5E2E\u52A9\u6587\u6863\u2019\uFF0C\u4F20\u5165tooltipProps.title\u53EF\u8986\u76D6 */\n hint?: React.ReactNode;\n /** \u6587\u6863\u9ED8\u8BA4\u8BED\u8A00\uFF0C\u8DF3\u8F6C\u4E0D\u5E26\u8BED\u8A00\u524D\u7F00\uFF0C\u9ED8\u8BA4en-US */\n defaultLocale?: string;\n /** \u63D0\u793A\u6846\u5C5E\u6027 */\n tooltipProps?: TooltipProps;\n}\n";
|