diff --git a/docs/docs/api/commonUI.md b/docs/docs/api/commonUI.md
index 350d60dd7..c0bbda588 100644
--- a/docs/docs/api/commonUI.md
+++ b/docs/docs/api/commonUI.md
@@ -19,6 +19,16 @@ CommonUI API 是一个专为低代码引擎设计的组件 UI 库,使用它开
| direction | tip 的方向 | 'top' \| 'bottom' \| 'left' \| 'right' | |
+### HelpTip
+
+带 help icon 的提示组件
+
+| 参数 | 说明 | 类型 | 默认值 |
+|-----------|--------|-----------------------------------|--------|
+| help | 描述 | IPublicTypeHelpTipConfig | |
+| direction | 方向 | IPublicTypeTipConfig['direction'] | 'top' |
+| size | 方向 | IconProps['size'] | 'small'|
+
### Title
标题组件
diff --git a/packages/editor-core/src/widgets/tip/help-tips.tsx b/packages/editor-core/src/widgets/tip/help-tips.tsx
new file mode 100644
index 000000000..ab5f65050
--- /dev/null
+++ b/packages/editor-core/src/widgets/tip/help-tips.tsx
@@ -0,0 +1,40 @@
+import { IPublicTypeHelpTipConfig, IPublicTypeTipConfig } from '@alilc/lowcode-types';
+import { Tip } from './tip';
+import { Icon } from '@alifd/next';
+import { IconProps } from '@alifd/next/types/icon';
+
+export function HelpTip({
+ help,
+ direction = 'top',
+ size = 'small',
+}: {
+ help: IPublicTypeHelpTipConfig;
+ direction?: IPublicTypeTipConfig['direction'];
+ size?: IconProps['size'];
+}) {
+ if (typeof help === 'string') {
+ return (
+
+
+ {help}
+
+ );
+ }
+
+ if (typeof help === 'object' && help.url) {
+ return (
+
+ );
+ }
+ return (
+
+
+ {help.content}
+
+ );
+}
\ No newline at end of file
diff --git a/packages/editor-core/src/widgets/tip/index.ts b/packages/editor-core/src/widgets/tip/index.ts
index dba4412c7..d2b376800 100644
--- a/packages/editor-core/src/widgets/tip/index.ts
+++ b/packages/editor-core/src/widgets/tip/index.ts
@@ -2,3 +2,4 @@ import './style.less';
export * from './tip';
export * from './tip-container';
+export * from './help-tips';
diff --git a/packages/editor-skeleton/src/components/widget-views/index.tsx b/packages/editor-skeleton/src/components/widget-views/index.tsx
index 2b2f6931c..7cdff4c01 100644
--- a/packages/editor-skeleton/src/components/widget-views/index.tsx
+++ b/packages/editor-skeleton/src/components/widget-views/index.tsx
@@ -1,7 +1,6 @@
import { Component, ReactElement } from 'react';
-import { Icon } from '@alifd/next';
import classNames from 'classnames';
-import { Title, observer, Tip } from '@alilc/lowcode-editor-core';
+import { Title, observer, HelpTip } from '@alilc/lowcode-editor-core';
import { DockProps } from '../../types';
import { PanelDock } from '../../widget/panel-dock';
import { composeTitle } from '../../widget/utils';
@@ -26,25 +25,6 @@ export function DockView({ title, icon, description, size, className, onClick }:
);
}
-function HelpTip({ tip }: any) {
- if (tip && tip.url) {
- return (
-
- );
- }
- return (
-
-
- {tip.content}
-
- );
-}
-
@observer
export class PanelDockView extends Component {
private lastActived = false;
@@ -328,7 +308,7 @@ class PanelTitle extends Component<{ panel: Panel; className?: string }> {
data-name={panel.name}
>
- {panel.help ? : null}
+ {panel.help ? : null}
);
}
diff --git a/packages/shell/src/api/commonUI.tsx b/packages/shell/src/api/commonUI.tsx
index cb4b7ae38..0a9021fe6 100644
--- a/packages/shell/src/api/commonUI.tsx
+++ b/packages/shell/src/api/commonUI.tsx
@@ -1,5 +1,6 @@
import { IPublicApiCommonUI, IPublicModelPluginContext, IPublicTypeContextMenuAction } from '@alilc/lowcode-types';
import {
+ HelpTip,
IEditor,
Tip as InnerTip,
Title as InnerTitle,
@@ -46,6 +47,11 @@ export class CommonUI implements IPublicApiCommonUI {
get Tip() {
return InnerTip;
}
+
+ get HelpTip() {
+ return HelpTip;
+ }
+
get Title() {
return InnerTitle;
}
diff --git a/packages/types/src/shell/api/commonUI.ts b/packages/types/src/shell/api/commonUI.ts
index 71e2bbe83..5ac025fcd 100644
--- a/packages/types/src/shell/api/commonUI.ts
+++ b/packages/types/src/shell/api/commonUI.ts
@@ -1,6 +1,7 @@
-import { ReactElement } from 'react';
-import { IPublicTypeContextMenuAction, IPublicTypeTitleContent } from '../type';
+import React, { ReactElement } from 'react';
+import { IPublicTypeContextMenuAction, IPublicTypeHelpTipConfig, IPublicTypeTipConfig, IPublicTypeTitleContent } from '../type';
import { Balloon, Breadcrumb, Button, Card, Checkbox, DatePicker, Dialog, Dropdown, Form, Icon, Input, Loading, Message, Overlay, Pagination, Radio, Search, Select, SplitButton, Step, Switch, Tab, Table, Tree, TreeSelect, Upload, Divider } from '@alifd/next';
+import { IconProps } from '@alifd/next/types/icon';
export interface IPublicApiCommonUI {
Balloon: typeof Balloon;
@@ -33,13 +34,30 @@ export interface IPublicApiCommonUI {
/**
* Title 组件
- * @experimental unstable API, pay extra caution when trying to use this
*/
- get Tip(): React.ComponentClass<{}>;
+ get Tip(): React.ComponentClass;
+
+ /**
+ * HelpTip 组件
+ */
+ get HelpTip(): React.VFC<{
+ help: IPublicTypeHelpTipConfig;
+
+ /**
+ * 方向
+ * @default 'top'
+ */
+ direction: IPublicTypeTipConfig['direction'];
+
+ /**
+ * 大小
+ * @default 'small'
+ */
+ size: IconProps['size'];
+ }>;
/**
* Tip 组件
- * @experimental unstable API, pay extra caution when trying to use this
*/
get Title(): React.ComponentClass<{
title: IPublicTypeTitleContent | undefined;
@@ -47,8 +65,10 @@ export interface IPublicApiCommonUI {
keywords?: string | null;
}>;
- get ContextMenu(): (props: {
+ get ContextMenu(): ((props: {
menus: IPublicTypeContextMenuAction[];
children: React.ReactElement[] | React.ReactElement;
- }) => ReactElement;
-}
\ No newline at end of file
+ }) => ReactElement) & {
+ create(menus: IPublicTypeContextMenuAction[], event: MouseEvent | React.MouseEvent): void;
+ };
+}